analysis.getVisitPage

本接口应在服务器端调用,详细说明参见服务端API

本接口支持云调用。需开发者工具版本 >= 1.02.1904090(最新稳定版下载),wx-server-sdk >= 0.4.0

访问页面。目前只提供按 page_visit_pv 排序的 top200。

调用方式:

HTTPS 调用

请求地址

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

请求参数

属性类型默认值必填说明
access_tokenstring接口调用凭证
begin_datestring开始日期。格式为 yyyymmdd
end_datestring结束日期,限定查询1天数据,允许设置的最大值为昨日。格式为 yyyymmdd

返回值

Object

返回的 JSON 数据包

属性类型说明
page_pathstring页面路径
page_visit_pvnumber访问次数
page_visit_uvnumber访问人数
page_staytime_pvnumber次均停留时长
entrypage_pvnumber进入页次数
exitpage_pvnumber退出页次数
page_share_pvnumber转发次数
page_share_uvnumber转发人数

请求数据示例

  1. {
  2. "begin_date" : "20170313",
  3. "end_date" : "20170313"
  4. }

返回数据示例

  1. {
  2. "ref_date": "20170313",
  3. "list": [
  4. {
  5. "page_path": "pages/main/main.html",
  6. "page_visit_pv": 213429,
  7. "page_visit_uv": 55423,
  8. "page_staytime_pv": 8.139198,
  9. "entrypage_pv": 117922,
  10. "exitpage_pv": 61304,
  11. "page_share_pv": 180,
  12. "page_share_uv": 166
  13. },
  14. {
  15. "page_path": "pages/linedetail/linedetail.html",
  16. "page_visit_pv": 155030,
  17. "page_visit_uv": 42195,
  18. "page_staytime_pv": 35.462395,
  19. "entrypage_pv": 21101,
  20. "exitpage_pv": 47051,
  21. "page_share_pv": 47,
  22. "page_share_uv": 42
  23. },
  24. {
  25. "page_path": "pages/search/search.html",
  26. "page_visit_pv": 65011,
  27. "page_visit_uv": 24716,
  28. "page_staytime_pv": 6.889634,
  29. "entrypage_pv": 1811,
  30. "exitpage_pv": 3198,
  31. "page_share_pv": 0,
  32. "page_share_uv": 0
  33. },
  34. {
  35. "page_path": "pages/stationdetail/stationdetail.html",
  36. "page_visit_pv": 29953,
  37. "page_visit_uv": 9695,
  38. "page_staytime_pv": 7.558508,
  39. "entrypage_pv": 1386,
  40. "exitpage_pv": 2285,
  41. "page_share_pv": 0,
  42. "page_share_uv": 0
  43. },
  44. {
  45. "page_path": "pages/switch-city/switch-city.html",
  46. "page_visit_pv": 8928,
  47. "page_visit_uv": 4017,
  48. "page_staytime_pv": 9.22659,
  49. "entrypage_pv": 748,
  50. "exitpage_pv": 1613,
  51. "page_share_pv": 0,
  52. "page_share_uv": 0
  53. }
  54. ]
  55. }

云调用

云调用是小程序·云开发提供的在云函数中调用微信开放接口的能力,需要在云函数中通过 wx-server-sdk 使用。

接口方法

  1. openapi.analysis.getVisitPage

需在 config.json 中配置 analysis.getVisitPage API 的权限,详情

请求参数

属性类型默认值必填说明
beginDatestring开始日期。格式为 yyyymmdd
endDatestring结束日期,限定查询1天数据,允许设置的最大值为昨日。格式为 yyyymmdd

返回值

Object

返回的 JSON 数据包

属性类型说明
pagePathstring页面路径
pageVisitPvnumber访问次数
pageVisitUvnumber访问人数
pageStaytimePvnumber次均停留时长
entrypagePvnumber进入页次数
exitpagePvnumber退出页次数
pageSharePvnumber转发次数
pageShareUvnumber转发人数

请求数据示例

  1. const cloud = require('wx-server-sdk')
  2. cloud.init({
  3. env: cloud.DYNAMIC_CURRENT_ENV,
  4. })
  5. exports.main = async (event, context) => {
  6. try {
  7. const result = await cloud.openapi.analysis.getVisitPage({
  8. beginDate: '20170313',
  9. endDate: '20170313'
  10. })
  11. return result
  12. } catch (err) {
  13. return err
  14. }
  15. }

返回数据示例

  1. {
  2. "refDate": "20170313",
  3. "list": [
  4. {
  5. "pagePath": "pages/main/main.html",
  6. "pageVisitPv": 213429,
  7. "pageVisitUv": 55423,
  8. "pageStaytimePv": 8.139198,
  9. "entrypagePv": 117922,
  10. "exitpagePv": 61304,
  11. "pageSharePv": 180,
  12. "pageShareUv": 166
  13. },
  14. {
  15. "pagePath": "pages/linedetail/linedetail.html",
  16. "pageVisitPv": 155030,
  17. "pageVisitUv": 42195,
  18. "pageStaytimePv": 35.462395,
  19. "entrypagePv": 21101,
  20. "exitpagePv": 47051,
  21. "pageSharePv": 47,
  22. "pageShareUv": 42
  23. },
  24. {
  25. "pagePath": "pages/search/search.html",
  26. "pageVisitPv": 65011,
  27. "pageVisitUv": 24716,
  28. "pageStaytimePv": 6.889634,
  29. "entrypagePv": 1811,
  30. "exitpagePv": 3198,
  31. "pageSharePv": 0,
  32. "pageShareUv": 0
  33. },
  34. {
  35. "pagePath": "pages/stationdetail/stationdetail.html",
  36. "pageVisitPv": 29953,
  37. "pageVisitUv": 9695,
  38. "pageStaytimePv": 7.558508,
  39. "entrypagePv": 1386,
  40. "exitpagePv": 2285,
  41. "pageSharePv": 0,
  42. "pageShareUv": 0
  43. },
  44. {
  45. "pagePath": "pages/switch-city/switch-city.html",
  46. "pageVisitPv": 8928,
  47. "pageVisitUv": 4017,
  48. "pageStaytimePv": 9.22659,
  49. "entrypagePv": 748,
  50. "exitpagePv": 1613,
  51. "pageSharePv": 0,
  52. "pageShareUv": 0
  53. }
  54. ],
  55. "errMsg": "openapi.analysis.getVisitPage:ok"
  56. }