# analysis.getWeeklyVisitTrend
Call this API at the server side. For more information, see Server API.
This API supports Cloud Calls. The WeChat DevTools version must be
1.02.1904090
or later (download the latest stable version here), and thewx-server-sdk
version must be0.4.0
or later.
Obtains the weekly trend from the data of user visits to a Mini Program.
Calling methods:
# HTTPS Call
# Request Address
POST https://api.weixin.qq.com/datacube/getweanalysisappidweeklyvisittrend?access_token=ACCESS_TOKEN
# Request Parameters
Attribute | Type | Default | Required | Description |
---|---|---|---|---|
access_token | string | Yes | Credentials to call API | |
begin_date | string | Yes | Start date. Its value is the date of Monday in the format of yyyymmdd. | |
end_date | string | Yes | End date. Its value is the date of Sunday in the format of yyyymmdd. Only the data of one week can be queried. |
# Return Value
# Object
JSON data package that is returned
Attribute | Type | Description |
---|---|---|
list | Array.<Object> | Data list. |
list is composed as follows
Property | Type | Description |
---|---|---|
ref_date | string | Date, in the format of yyyymmdd-yyyymmdd, for example, "20170306–20170312". |
session_cnt | number | Number of times the Mini Program is opened (The total number within a natural week) |
visit_pv | number | Number of visits (The total number within a natural week) |
visit_uv | number | Number of visitors (The total number within a natural week after deduplication) |
visit_uv_new | number | Number of new users (The total number within a natural week after deduplication) |
stay_time_uv | number | Average stay time per capita (floating-point type. Unit: second) |
stay_time_session | number | Average stay time per visit (floating-point type. Unit: second) |
visit_depth | number | Average visit depth (floating-point type) |
# Access Cycle
Only the data of one natural week can be queried, and the time must be entered according to the natural week, for example, 20170306 (Monday) and 20170312 (Sunday).
# Request Data Example
{
"begin_date" : "20170306",
"end_date" : "20170312"
}
# Return Data Example
{
"list": [
{
"ref_date": "20170306-20170312",
"session_cnt": 986780,
"visit_pv": 3251840,
"visit_uv": 189405,
"visit_uv_new": 45592,
"stay_time_session": 54.5346,
"visit_depth": 1.9735
}
]
}
# Cloud Call
Cloud call is a capability provided by Mini Program·Cloud Base that allows you to call WeChat APIs in a cloud function. It must be used via
wx-server-sdk
in the cloud function.
# API Calling Method
openapi.analysis.getWeeklyVisitTrend
You need to configure the permissions for the
analysis.getWeeklyVisitTrend
API viaconfig.json
. Details
# Request Parameters
Attribute | Type | Default | Required | Description |
---|---|---|---|---|
beginDate | string | Yes | Start date. Its value is the date of Monday in the format of yyyymmdd. | |
endDate | string | Yes | End date. Its value is the date of Sunday in the format of yyyymmdd. Only the data of one week can be queried. |
# Return Value
# Object
JSON data package that is returned
Attribute | Type | Description |
---|---|---|
list | Array.<Object> | Data list. |
list is composed as follows
Property | Type | Description |
---|---|---|
refDate | string | Date, in the format of yyyymmdd-yyyymmdd, for example, "20170306–20170312". |
sessionCnt | number | Number of times the Mini Program is opened (The total number within a natural week) |
visitPv | number | Number of visits (The total number within a natural week) |
visitUv | number | Number of visitors (The total number within a natural week after deduplication) |
visitUvNew | number | Number of new users (The total number within a natural week after deduplication) |
stayTimeUv | number | Average stay time per capita (floating-point type. Unit: second) |
stayTimeSession | number | Average stay time per visit (floating-point type. Unit: second) |
visitDepth | number | Average visit depth (floating-point type) |
# Request Data Example
const cloud = require('wx-server-sdk')
cloud.init()
exports.main = async (event, context) => {
try {
const result = await cloud.openapi.analysis.getWeeklyVisitTrend({
beginDate: '20170306',
endDate: '20170312'
})
console.log(result)
return result
} catch (err) {
console.log(err)
return err
}
}
# Return Data Example
{
"list": [
{
"refDate": "20170306-20170312",
"sessionCnt": 986780,
"visitPv": 3251840,
"visitUv": 189405,
"visitUvNew": 45592,
"stayTimeSession": 54.5346,
"visitDepth": 1.9735
}
],
"errMsg": "openapi.analysis.getWeeklyVisitTrend:ok"
}