# analysis.getVisitPage

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 the wx-server-sdk version must be 0.4.0 or later.

Visits pages. Only top 200 pages sorted by page_visit_pv are provided.

Calling methods:

# HTTPS Call

# Request Address

POST https://api.weixin.qq.com/datacube/getweanalysisappidvisitpage?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
page_path string Page path
page_visit_pv number Number of visits
page_visit_uv number Number of visitors
page_staytime_pv number Average stay time per visit
entrypage_pv number Number of page entries
exitpage_pv number Number of page exits
page_share_pv number Number of forwards
page_share_uv number Number of forwarders

# Request Data Example

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

# Return Data Example

{
  "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 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.getVisitPage

You need to configure the permissions for the analysis.getVisitPage API via config.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
pagePath string Page path
pageVisitPv number Number of visits
pageVisitUv number Number of visitors
pageStaytimePv number Average stay time per visit
entrypagePv number Number of page entries
exitpagePv number Number of page exits
pageSharePv number Number of forwards
pageShareUv number Number of forwarders

# Request Data Example

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'
      })
      console.log(result)
      return result
    } catch (err) {
      console.log(err)
      return err
    }
  }

# Return Data Example

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