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

WeChat small program API data and user portraits


May 19, 2021 WeChat Mini Program Development Document


Table of contents


Portrait of the user

Get portrait distribution data for new or active users of small programs. T he time range supports yesterday, the last 7 days, the last 30 days. A mong them, the number of new users is the number of heavy-weight users who first access the small program in the time range, and the number of active users is the number of the out-of-heavy users who have accessed the small program in the time range. Portrait properties include user age, gender, province, city, terminal type, model.

Interface address: https://api.weixin.qq.com/datacube/getweanalysisappiduserportrait?access_token=ACCESS_TOKEN

POST Request Parameter Description:

Parameters Is it required Description
begin_date Is The start date
end_date Is The end date, with the number of days between the start date and the end date limited to 0/6/29, represents the most recent 1/7/30 day data for the query, and the maximum allowed for end_date is yesterday

POST content example:

{
    "begin_date" : "2017-06-11",
    "end_date" : "2017-06-17"
}

Return the parameter description:

Each request returns the selected time range and the following metrics:

Parameters Description
ref_date Time range, e.g. "20170611-20170617"
visit_uv_new New users
visit_uv Active users

Properties included under each metric:

Parameters Description
province provinces, such as Beijing, Guangdong, etc
city Cities, such as Beijing, Guangzhou, etc
genders Gender, including male, female, unknown
platfomrs Terminal types, including iPhone, android, others
devices Models such as Apple's iPhone 6, OPPO R9, etc
ages Age, including under 17 years old, 18-24 years old and so on

Data items included under each property:

Parameters Description
Id The property value id
name The property value name, which corresponds to id one-to-one. If the property is profile, the returned property value name includes "Guangdong" and so on
value The property value corresponds to the indicator value, such as the indicator is visit_uv, the property is profile, the property value is "Guangdong Province", and the value corresponds to the number of active users in Guangdong

Return an example of the data:

{
  "ref_date": "20170611",
  "visit_uv_new": {
    "province": [
      {
        "id": 31,
        "name": "广东省",
        "value": 215
      }
    ],
    "city": [
     {
        "id": 3102,
        "name": "广州",
        "value": 78
      }
    ],
    "genders": [
      {
        "id": 1,
        "name": "男",
        "value": 2146
      }
    ],
    "platforms": [
      {
        "id": 1,
        "name": "iPhone",
        "value": 27642
      }
    ],
    "devices": [
      {
        "name": "OPPO R9",
        "value": 61
      }
    ],
    "ages": [
      {
        "id": 1,
        "name": "17岁以下",
        "value": 151
      }
    ]
  },
  "visit_uv": {
    "province": [
      {
        "id": 31,
        "name": "广东省",
        "value": 1341
      }
    ],
    "city": [
     {
        "id": 3102,
        "name": "广州",
        "value": 234
      }
    ],
    "genders": [
      {
        "id": 1,
        "name": "男",
        "value": 14534
      }
    ],
    "platforms": [
      {
        "id": 1,
        "name": "iPhone",
        "value": 21750
      }
    ],
    "devices": [
      {
        "name": "OPPO R9",
        "value": 617
      }
    ],
    "ages": [
      {
        "id": 1,
        "name": "17岁以下",
        "value": 3156
      }
    ]
  }
}

Note:

  1. The property value may be "unknown" due to the loss of some user property data.
  2. Model data does not have an id field and only top20 with the largest number of users is available for the time being.