# analysis.getMonthlyVisitTrend
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 monthly trend from the data of user visits to a Mini Program.
Calling methods:
# HTTPS Call
# Request Address
POST https://api.weixin.qq.com/datacube/getweanalysisappidmonthlyvisittrend?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. It is the first day of the natural month, in the format of yyyymmdd. | |
end_date | string | Yes | End date, in the format of yyyymmdd. It is the last day of the natural month. Only the data of one month 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 yyyymm, for example, "201702". |
session_cnt | number | Number of times the Mini Program is opened (The total number within a natural month) |
visit_pv | number | Number of visits (The total number within a natural month) |
visit_uv | number | Number of visitors (The total number within a natural month after deduplication) |
visit_uv_new | number | Number of new users (The total number within a natural month 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 month can be queried, and the time must be entered according to the natural month, for example, 20170301 and 20170331.
# Request Data Example
{
"begin_date" : "20170301",
"end_date" : "20170331"
}
# Return Data Example
{
"list": [
{
"ref_date": "201703",
"session_cnt": 126513,
"visit_pv": 426113,
"visit_uv": 48659,
"visit_uv_new": 6726,
"stay_time_session": 56.4112,
"visit_depth": 2.0189
}
]
}
# 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.getMonthlyVisitTrend
You need to configure the permissions for the
analysis.getMonthlyVisitTrend
API viaconfig.json
. Details
# Request Parameters
Attribute | Type | Default | Required | Description |
---|---|---|---|---|
beginDate | string | Yes | Start date. It is the first day of the natural month, in the format of yyyymmdd. | |
endDate | string | Yes | End date, in the format of yyyymmdd. It is the last day of the natural month. Only the data of one month 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 yyyymm, for example, "201702". |
sessionCnt | number | Number of times the Mini Program is opened (The total number within a natural month) |
visitPv | number | Number of visits (The total number within a natural month) |
visitUv | number | Number of visitors (The total number within a natural month after deduplication) |
visitUvNew | number | Number of new users (The total number within a natural month 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.getMonthlyVisitTrend({
beginDate: '20170301',
endDate: '20170331'
})
console.log(result)
return result
} catch (err) {
console.log(err)
return err
}
}
# Return Data Example
{
"list": [
{
"refDate": "201703",
"sessionCnt": 126513,
"visitPv": 426113,
"visitUv": 48659,
"visitUvNew": 6726,
"stayTimeSession": 56.4112,
"visitDepth": 2.0189
}
],
"errMsg": "openapi.analysis.getMonthlyVisitTrend:ok"
}