# analysis.getDailyVisitTrend
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 daily trend from the data of user visits to a Mini Program.
Calling methods:
# HTTPS Call
# Request Address
POST https://api.weixin.qq.com/datacube/getweanalysisappiddailyvisittrend?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, in the format of yyyymmdd. | |
end_date | string | Yes | End date, in the format of yyyymmdd. Only the data of one day can be queried, and the maximum value is the previous day. |
# 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. |
session_cnt | number | Number of times the Mini Program is opened |
visit_pv | number | Number of visits |
visit_uv | number | Number of visitors |
visit_uv_new | number | Number of new users |
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) |
# Request Data Example
{
"begin_date" : "20170313",
"end_date" : "20170313"
}
# Return Data Example
{
"list": [
{
"ref_date": "20170313",
"session_cnt": 142549,
"visit_pv": 472351,
"visit_uv": 55500,
"visit_uv_new": 5464,
"stay_time_session": 0,
"visit_depth": 1.9838
}
]
}
# 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.getDailyVisitTrend
You need to configure the permissions for the
analysis.getDailyVisitTrend
API viaconfig.json
. Details
# Request Parameters
Attribute | Type | Default | Required | Description |
---|---|---|---|---|
beginDate | string | Yes | Start date, in the format of yyyymmdd. | |
endDate | string | Yes | End date, in the format of yyyymmdd. Only the data of one day can be queried, and the maximum value is the previous day. |
# 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. |
sessionCnt | number | Number of times the Mini Program is opened |
visitPv | number | Number of visits |
visitUv | number | Number of visitors |
visitUvNew | number | Number of new users |
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.getDailyVisitTrend({
beginDate: '20170313',
endDate: '20170313'
})
console.log(result)
return result
} catch (err) {
console.log(err)
return err
}
}
# Return Data Example
{
"list": [
{
"refDate": "20170313",
"sessionCnt": 142549,
"visitPv": 472351,
"visitUv": 55500,
"visitUvNew": 5464,
"stayTimeSession": 0,
"visitDepth": 1.9838
}
],
"errMsg": "openapi.analysis.getDailyVisitTrend:ok"
}