获取访问页面数据
接口应在服务器端调用,详细说明参见服务端API。
本接口支持云调用。需开发者工具版本 >=
1.02.1904090
(最新稳定版下载),wx-server-sdk
>=0.4.0
接口说明
接口英文名
getVisitPage
功能描述
该接口用于访问页面。目前只提供按 page_visit_pv 排序的 top200。
调用方式
HTTPS 调用
POST https://api.weixin.qq.com/datacube/getweanalysisappidvisitpage?access_token=ACCESS_TOKEN
云调用
- 出入参和HTTPS调用相同,调用方式可查看云调用说明文档
- 接口方法为: openapi.analysis.getVisitPage
第三方调用
- 调用方式以及出入参和HTTPS相同,仅是调用的token不同
- 该接口所属的权限集id为:18、21
- 服务商获得其中之一权限集授权后,可通过使用authorizer_access_token代商家进行调用
请求参数
属性 | 类型 | 必填 | 说明 |
---|---|---|---|
access_token | string | 是 | 接口调用凭证,该参数为 URL 参数,非 Body 参数。使用access_token或者authorizer_access_token |
begin_date | string | 是 | 开始日期。格式为 yyyymmdd |
end_date | string | 是 | 结束日期,限定查询1天数据,允许设置的最大值为昨日。格式为 yyyymmdd |
返回参数
属性 | 类型 | 说明 | |
---|---|---|---|
ref_date | string | 日期,格式为 yyyymmdd | |
list | array | 数据列表 | |
属性类型说明page_pathstring页面路径page_visit_pvnumber访问次数page_visit_uvnumber访问人数page_staytime_pvnumber次均停留时长entrypage_pvnumber进入页次数exitpage_pvnumber退出页次数page_share_pvnumber转发次数page_share_uvnumber转发人数 |
调用示例
示例说明: HTTPS调用
请求数据示例
{
"begin_date" : "20170313",
"end_date" : "20170313"
}
返回数据示例
{
"ref_date": "20170313",
"list": [
{
"page_path": "pages/main/main.html",
"page_visit_pv": 213429,
"page_visit_uv": 55423,
"page_staytime_pv": 8.139198,
"entrypage_pv": 117922,
"exitpage_pv": 61304,
"page_share_pv": 180,
"page_share_uv": 166
},
{
"page_path": "pages/linedetail/linedetail.html",
"page_visit_pv": 155030,
"page_visit_uv": 42195,
"page_staytime_pv": 35.462395,
"entrypage_pv": 21101,
"exitpage_pv": 47051,
"page_share_pv": 47,
"page_share_uv": 42
},
{
"page_path": "pages/search/search.html",
"page_visit_pv": 65011,
"page_visit_uv": 24716,
"page_staytime_pv": 6.889634,
"entrypage_pv": 1811,
"exitpage_pv": 3198,
"page_share_pv": 0,
"page_share_uv": 0
},
{
"page_path": "pages/stationdetail/stationdetail.html",
"page_visit_pv": 29953,
"page_visit_uv": 9695,
"page_staytime_pv": 7.558508,
"entrypage_pv": 1386,
"exitpage_pv": 2285,
"page_share_pv": 0,
"page_share_uv": 0
},
{
"page_path": "pages/switch-city/switch-city.html",
"page_visit_pv": 8928,
"page_visit_uv": 4017,
"page_staytime_pv": 9.22659,
"entrypage_pv": 748,
"exitpage_pv": 1613,
"page_share_pv": 0,
"page_share_uv": 0
}
]
}
示例说明: 云函数调用
请求数据示例
const cloud = require('wx-server-sdk')
cloud.init({
env: cloud.DYNAMIC_CURRENT_ENV,
})
exports.main = async (event, context) => {
try {
const result = await cloud.openapi.analysis.getVisitPage({
"beginDate": '20170313',
"endDate": '20170313'
})
return result
} catch (err) {
return err
}
}
返回数据示例
{
"refDate": "20170313",
"list": [
{
"pagePath": "pages/main/main.html",
"pageVisitPv": 213429,
"pageVisitUv": 55423,
"pageStaytimePv": 8.139198,
"entrypagePv": 117922,
"exitpagePv": 61304,
"pageSharePv": 180,
"pageShareUv": 166
},
{
"pagePath": "pages/linedetail/linedetail.html",
"pageVisitPv": 155030,
"pageVisitUv": 42195,
"pageStaytimePv": 35.462395,
"entrypagePv": 21101,
"exitpagePv": 47051,
"pageSharePv": 47,
"pageShareUv": 42
},
{
"pagePath": "pages/search/search.html",
"pageVisitPv": 65011,
"pageVisitUv": 24716,
"pageStaytimePv": 6.889634,
"entrypagePv": 1811,
"exitpagePv": 3198,
"pageSharePv": 0,
"pageShareUv": 0
},
{
"pagePath": "pages/stationdetail/stationdetail.html",
"pageVisitPv": 29953,
"pageVisitUv": 9695,
"pageStaytimePv": 7.558508,
"entrypagePv": 1386,
"exitpagePv": 2285,
"pageSharePv": 0,
"pageShareUv": 0
},
{
"pagePath": "pages/switch-city/switch-city.html",
"pageVisitPv": 8928,
"pageVisitUv": 4017,
"pageStaytimePv": 9.22659,
"entrypagePv": 748,
"exitpagePv": 1613,
"pageSharePv": 0,
"pageShareUv": 0
}
],
"errMsg": "openapi.analysis.getVisitPage:ok"
}
错误码
错误码 | 错误码取值 | 解决方案 |
---|---|---|
-1 | system error | 系统繁忙,此时请开发者稍候再试 |
40001 | invalid credential access_token isinvalid or not latest | 获取 access_token 时 AppSecret 错误,或者 access_token 无效。请开发者认真比对 AppSecret 的正确性,或查看是否正在为恰当的公众号调用接口 |