Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

WeChat gadget getVisitPage


May 19, 2021 WeChat Mini Program Development Document


Table of contents


analysis.getVisitPage

This interface should be called on the server side, as detailed in the Service Side API.
This interface supports cloud calls. Developer tool version required . . . 1.02.1904090 (latest stable download)
wx-server-sdk >= 0.4.0

Visit the page. Currently, only top200 page_visit_pv sorted by the list is available.

How to call:

  • HTTPS call
  • Cloud calls

HTTPS call

The request address

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

Request parameters

Property Type The default Required Description
access_token string Is The interface calls the credentials
begin_date string Is The start date. The format is yyyymmdd
end_date string Is End date, limit queries to 1 day of data, allow setting the maximum value for yesterday. The format is yyyymmdd

Returns a value

Object

The returned JSON packet

Property Type Description
page_path string The page path
page_visit_pv number Number of visits
page_visit_uv number Number of visitors
page_staytime_pv number The duration of each stay
entrypage_pv number Number of pages entered
exitpage_pv number Number of exit pages
page_share_pv number Number of forwards
page_share_uv number The number of forwards

An example of requesting data

{
  "begin_date" : "20170313",
  "end_date" : "20170313"
}

Return an example of the data

{
  "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
    }
  ]
}

Cloud calls

Cloud call is the ability provided by the small program Cloud Development to call WeChat open interfaces in cloud functions and need to be used in cloud functions via wx-server-sdk.

The interface method

openapi.analysis.getVisitPage
The permissions for the analysis.getVisitPage API need to be configured in config.json, details

Request parameters

Property Type The default Required Description
beginDate string Is The start date. The format is yyyymmdd
endDate string Is End date, limit queries to 1 day of data, allow setting the maximum value for yesterday. The format is yyyymmdd

Returns a value

Object

The returned JSON packet

Property Type Description
pagePath string The page path
pageVisitPv number Number of visits
pageVisitUv number Number of visitors
pageStaytimePv number The duration of each stay
entrypagePv number Number of pages entered
exitpagePv number Number of exit pages
pageSharePv number Number of forwards
pageShareUv number The number of forwards

An example of requesting data

const cloud = require('wx-server-sdk')
cloud.init()
exports.main = async (event, context) => {
  try {
    const result = await cloud.openapi.analysis.getVisitPage({
        beginDate: '20170313',
        endDate: '20170313'
      })
    return result
  } catch (err) {
    return err
  }
}

Return an example of the data

{
  "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"
}