Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

WeChat gadget getVisitDistribution


May 19, 2021 WeChat Mini Program Development Document


Table of contents


analysis.getVisitDistribution

This interface should be called on the server side, as detailed in the Service Side API.
This interface supports cloud calls. Developer tool version required . . . 1.02.1904090 (latest stable download)
wx-server-sdk >= 0.4.0

Gets the user's gadget to access the distribution data

How to call:

  • HTTPS call
  • Cloud calls

HTTPS call

The request address

POST https://api.weixin.qq.com/datacube/getweanalysisappidvisitdistribution?access_token=ACCESS_TOKEN

Request parameters

Property Type The default Required Description
access_token string Is The interface calls the credentials
begin_date string Is The start date. The format is yyyymmdd
end_date string Is End date, limit queries to 1 day of data, and allow the maximum value to be set for yesterday. The format is yyyymmdd

Returns a value

Object

The returned JSON packet

Property Type Description
ref_date string Date, in yyyymmdd
list Array.<Object> The list of data

The structure of the list

Property Type Description
index number The type of distribution
item_list Array.<Object> A list of distributed data

The legal value of index

Value Description The lowest version
access_source_session_cnt Access the source distribution
access_staytime_info The length of access distribution
access_depth_info Access the distribution of depth

item_list structure of the system

Property Type Description
key number Scenario id, defined differently under each index, see the table below
value number The scene id accesses pv
access_source_visit_uv number The scene id accesses uv

An example of requesting data

{
  "begin_date" : "20170313",
  "end_date" : "20170313"
}

Return an example of the data

{
  "ref_date": "20170313",
  "list": [
    {
      "index": "access_source_session_cnt",
      "item_list": [
        {
          "key": 10,
          "value": 5
        },
        {
          "key": 8,
          "value": 687
        },
        {
          "key": 7,
          "value": 10740
        },
        {
          "key": 6,
          "value": 1961
        },
        {
          "key": 5,
          "value": 677
        },
        {
          "key": 4,
          "value": 653
        },
        {
          "key": 3,
          "value": 1120
        },
        {
          "key": 2,
          "value": 10243
        },
        {
          "key": 1,
          "value": 116578
        }
      ]
    },
    {
      "index": "access_staytime_info",
      "item_list": [
        {
          "key": 8,
          "value": 16329
        },
        {
          "key": 7,
          "value": 19322
        },
        {
          "key": 6,
          "value": 21832
        },
        {
          "key": 5,
          "value": 19539
        },
        {
          "key": 4,
          "value": 29670
        },
        {
          "key": 3,
          "value": 19667
        },
        {
          "key": 2,
          "value": 11794
        },
        {
          "key": 1,
          "value": 4511
        }
      ]
    },
    {
      "index": "access_depth_info",
      "item_list": [
        {
          "key": 5,
          "value": 217
        },
        {
          "key": 4,
          "value": 3259
        },
        {
          "key": 3,
          "value": 32445
        },
        {
          "key": 2,
          "value": 63542
        },
        {
          "key": 1,
          "value": 43201
        }
      ]
    }
  ]
}

Access the source key correspondence (index is "access_source_session_cnt"), and the description of the scene value is shown in the scene value

key Access the source The corresponding scene value
1 A list of program history 1001 1002 1004
2 Search 1005 1006 1027 1042 1053 1106 1108 1132
3 Session 1007 1008 1044 1093 1094 1096
4 Sweep the QR code 1011 1025 1047 1105 1124 1150
5 Public number home page 1020
6 Chat top 1022
7 The system desktop 1023 1113 1114 1117
8 The home page of the small program 1024 1135
9 Small programs nearby 1026 1033 1068
11 The template message 1014 1043 1107 1162
12 Customer service messages 1021
13 Public number menu 1035 1102 1130
14 APP sharing 1036
15 Payment completion page 1034 1060 1072 1097 1109 1137 1149
16 Press and hold to identify the QR code 1012 1048 1050 1125
17 The album selects a QR code 1013 1049 1126
18 Public article 1058 1091
19 Wallet 1019 1057 1061 1066 1070 1071
20 Card bag 1028 1128 1148
21 Small in-program card coupons 1029 1062
22 Other small programs 1037
23 Other small programs return 1038
24 A list of stores where vouchers apply 1052
25 Search for a quick entry to the box 1054
26 Small program customer service message 1073 1081
27 The public number is issued 1074 1076 1082 1152
28 The system session menu 1080 1083 1088
29 Taskbar - Recently used 1089
30 Press and hold the small program menu dot 1085 1090 1147
31 Connect to the wifi success page 1064 1078
32 City services 1092
33 WeChat ads 1045 1046 1067 1084 1095
34 Other mobile apps 1065 1069 1111 1140
35 Discover the entrance - my little program 1003 1103
36 Taskbar - My Little Program 1104
37 WeChat Circle 1138 1163
38 Recharge your phone 1098
39 H5 1018 1055
40 Plug - ins 1040 1041 1099
41 Everybody's using it 1118 1145
42 The page was found 1112 1141 1142 1143
43 Floating windows 1131
44 people nearby 1075 1134
45 Take a look 1115
46 Circle of friends 1009 1110 1154 1155
47 Enterprise WeChat 1119 1120 1121 1122 1123 1156
48 Video 1136 1144
49 Collection 1010
50 WeChat Red Pack 1100
51 WeChat Game Center 1079 1127
52 Shake it 1039 1077
53 Public number guide purchase news 1157
54 knowledge 1153
55 Small program orders 1151
56 Small program live 1161
57 Group tools 1158 1159 1160
10 Other The scene values in addition to the above

Access time key correspondence (index s"access_staytime_info")

key The length of the visit
1 0-2s
2 3-5s
3 6-10s
4 11-20s
5 20-30s
6 30-50s
7 50-100s
8 >100s

Average access depth key correspondence (index - "access_depth_info")

key The length of the visit
1 1 page
2 2 pages
3 3 pages
4 4 pages
5 5 pages
6 6-10 pages
7 10 pages

Cloud calls

Cloud call is the ability provided by the small program Cloud Development to call WeChat open interfaces in cloud functions and need to be used in cloud functions via wx-server-sdk.

The interface method

openapi.analysis.getVisitDistribution
Permissions for the analysis.getVisitDistribution API need to be configured in config.json, details

Request parameters

Property Type The default Required Description
beginDate string Is The start date. The format is yyyymmdd
endDate string Is End date, limit queries to 1 day of data, and allow the maximum value to be set for yesterday. The format is yyyymmdd

Returns a value

Object

The returned JSON packet

Property Type Description
refDate string Date, in yyyymmdd
list Array.<Object> The list of data

The structure of the list

Property Type Description
index number The type of distribution
itemList Array.<Object> A list of distributed data

The legal value of index

Value Description The lowest version
access_source_session_cnt Access the source distribution
access_staytime_info The length of access distribution
access_depth_info Access the distribution of depth

The structure of itemList

Property Type Description
key number Scenario id, defined differently under each index, see the table below
value number The scene id accesses pv
accessSourceVisitUv number The scene id accesses uv

An example of requesting data

const cloud = require('wx-server-sdk')
cloud.init()
exports.main = async (event, context) => {
  try {
    const result = await cloud.openapi.analysis.getVisitDistribution({
        beginDate: '20170313',
        endDate: '20170313'
      })
    return result
  } catch (err) {
    return err
  }
}

Return an example of the data

{
  "refDate": "20170313",
  "list": [
    {
      "index": "access_source_session_cnt",
      "itemList": [
        {
          "key": 10,
          "value": 5
        },
        {
          "key": 8,
          "value": 687
        },
        {
          "key": 7,
          "value": 10740
        },
        {
          "key": 6,
          "value": 1961
        },
        {
          "key": 5,
          "value": 677
        },
        {
          "key": 4,
          "value": 653
        },
        {
          "key": 3,
          "value": 1120
        },
        {
          "key": 2,
          "value": 10243
        },
        {
          "key": 1,
          "value": 116578
        }
      ]
    },
    {
      "index": "access_staytime_info",
      "itemList": [
        {
          "key": 8,
          "value": 16329
        },
        {
          "key": 7,
          "value": 19322
        },
        {
          "key": 6,
          "value": 21832
        },
        {
          "key": 5,
          "value": 19539
        },
        {
          "key": 4,
          "value": 29670
        },
        {
          "key": 3,
          "value": 19667
        },
        {
          "key": 2,
          "value": 11794
        },
        {
          "key": 1,
          "value": 4511
        }
      ]
    },
    {
      "index": "access_depth_info",
      "itemList": [
        {
          "key": 5,
          "value": 217
        },
        {
          "key": 4,
          "value": 3259
        },
        {
          "key": 3,
          "value": 32445
        },
        {
          "key": 2,
          "value": 63542
        },
        {
          "key": 1,
          "value": 43201
        }
      ]
    }
  ],
  "errMsg": "openapi.analysis.getVisitDistribution:ok"
}