# Dxplaination of the ad analysis data interface

Open data interfaces to all Official Account, Weixin Mini Program, MiniGame developers who become traffic masters.Through the data interface, developers can access data similar to, but more flexible, statistical modules on the public platform's official website, and can perform advanced processing as needed.

Please note:

  1. The interface-side database only stores data after January 1, 2016, and previous data will not be retrieved, and even if it is found, it will be untrusted and dirty;

  2. It is recommended that developers save the data in their own databases after calling the interface to obtain the data, to maximize the efficiency of access and also to reduce unnecessary losses from the WeChat side interface calls.

  3. Due to the large amount of data, all interfaces take a page-by-page approach, with a maximum page acquisition of 90.(eg: total_num is 100, then when page = 1, page_size = 10, the first 10 entries are returned;)Page = 1, page_size = 20, then the first 20 entries are returned;Page = 2, page_size = 10, then return articles 11 to 20)

  4. Instructions for changing the ad space enumeration value

    • Since multiple interfaces use ad space parameters, to ensure consistency of the experience and readability of the parameters,We made some changes so that all the interfaces support the ad-slot type name (ad_slot) and passing parameters, adding this name to represent the relevant meaning when repackaging.The previous parameter slot_id can also be used and passed back. Specifically:
Ad_slot type name (ad_slot) Types of ad space
SLOT_ID_BIZ_BOTTOM Official Account Bottom Ads
SLOT_ID_BIZ_MID_CONTEXT Official Account Advertisement in text
SLOT_ID_BIZ_VIDEO_END Official Account Video post
SLOT_ID_BIZ_SPONSOR Official Account Alternative advertising
SLOT_ID_BIZ_CPS Official Account Rebate Goods
SLOT_ID_WEAPP_BANNER Weixin Mini Program banner
SLOT_ID_WEAPP_REWARD_VIDEO Weixin Mini Program Motivational Video
SLOT_ID_WEAPP_INTERSTITIAL Weixin Mini Program Plug-in advertising
SLOT_ID_WEAPP_VIDEO_FEEDS Weixin Mini Program Video advertising
SLOT_ID_WEAPP_VIDEO_BEGIN Weixin Mini Program Video pre-post
SLOT_ID_WEAPP_BOX Weixin Mini Program Plaid advertising
SLOT_ID_WEAPP_TEMPLATE Weixin Mini Program Native template advertising
SLOT_ID_WEAPP_COVER Cover advertisement



# Interface Overview

The ad analysis interface is currently available to obtain some of the ad data shown on the Public Platform → Traffic Owners → Statistics page and some of the revenue data shown in the Public Platform > Traffic owners → Financial Management page. The list of interfaces associated with Weixin Mini Program is as follows:

Interface Name use Maximum time span Interface call address (must use https)
publisher_adpos_general Get Weixin Mini Program ad summary data 90 days https://api.weixin.qq.com/publisher/stat?action=publisher_adpos_general&access_token=ACCESS_TOKEN
publisher_adunit_general Get Weixin Mini Program ad segmentation data 90 days https://api.weixin.qq.com/publisher/stat?action=publisher_adunit_general&access_token=ACCESS_TOKEN
get_adunit_list Get Weixin Mini Program Alert list nothing https://api.weixin.qq.com/publisher/stat?action=get_adunit_list&access_token=ACCESS_TOKEN
publisher_settlement Get Weixin Mini Program settlement income data and settlement entity information nothing https://api.weixin.qq.com/publisher/stat?action=publisher_settlement&access_token=ACCESS_TOKEN



# Dxplaination of Interface Call Request

# I. Get Weixin Mini Program ad summary data (publisher_adpos_general)

You need to add the following GET request parameters to the appropriate interface call address:

parameter Do I have to? Introductions
page yes Back to the next few pages of data
page_size yes When the page returns the number of data entries
start_date yes Get the start time of the data yyyy-mm-dd
end_date yes Get the end time of the data yyyy-mm-dd
ad_slot no Ad space type name

Note: If you do not pass atype name, data for alltypes will be returned by default.



Returns parameter explaination (publisher_adpos_general)

parameter Introductions
err_msg Return an error message
ret Error code
list: slot_id Type ID
list: ad_slot Ad space type name
list: date date
list: req_succ_count Pullout amount
list: exposure_count Exposures
list: exposure_rate Exposure
list: click_count Clicks
list: click_rate click-through rate
list: income Income (in percentages)
list: ecpm Ad's 1,000 exposure gains (in points)
summary: req_succ_count Total pullout
summary: exposure_count Total Exposure
summary: exposure_rate Total Exposure
summary: click_count Total hits
summary: click_rate Total click rate
summary: income Total income (in percentages)
summary: ecpm Ad's 1,000 exposure gains (in points)
total_num List returns the total number of bars



Return packet example (publisher_adpos_general)

{
    "base_resp":{
        "err_msg":"ok",
        "ret":0
    },
    "list":[
        {
            "slot_id":3030046789020061,
            "ad_slot":"SLOT_ID_WEAPP_INTERSTITIAL",
            "date":"2020-04-13",
            "req_succ_count":443610,
            "exposure_count":181814,
            "exposure_rate":0.409850995,
            "click_count":10095,
            "click_rate":0.055523777,
            "income":52175,
            "ecpm":286.969100289
        }
    ],
    "summary":{
        "req_succ_count":4406394,
        "exposure_count":1797225,
        "exposure_rate":0.407867522,
        "click_count":100167,
        "click_rate":0.055734257,
        "income":578003,
        "ecpm":321.608591022
    },
    "total_num":1
}



# II. Get Weixin Mini Program ad segmentation data (publisher_adunit_general)

You need to add the following GET request parameters to the appropriate interface call address:

parameter Do I have to? Introductions
page yes Back to the next few pages of data
page_size yes When the page returns the number of data entries
start_date yes Get the start date of the data yyyy-mm-dd
end_date yes Get the end time of the data yyyy-mm-dd
ad_slot no Ad space type name
ad_unit_id no Wide ID.

Please note: When you need to get the breakdown data of all**, you do not need to pass the TAG-type name and TAG-id;When you need to obtain breakdown data for a certain type of ad space, you only need to pass the name of the ad space type; When you need to get the breakdown data of a Guangzhou ID, only the Guangzhou ID is passed.



Returns parameter explaination (publisher_adunit_general)

parameter Introductions
err_msg Return an error message
ret Error code
list: ad_unit_id Wide ID.
list: ad_unit_name Ad space name
list: stat_item: ad_slot Ad space type name
list: stat_item :date Date of data
list: stat_item :req_succ_count Pullout amount
list: stat_item :exposure_count Exposures
list: stat_item: exposure_rate Exposure
list: stat_item :click_count Clicks
list: stat_item :click_rate click-through rate
list: stat_item :income income
list: stat_item :ecpm Ad's 1,000 exposure gains (in points)
total_num Request returns total number



Returned packet example (publisher_adunit_general)

{
    "base_resp":{
        "err_msg":"ok",
        "ret":0
    },
    "list":[
        {
            "ad_unit_id":"adunit-9cedd8514XXXX",
            "ad_unit_name":"激励视频长广告",
            "stat_item":{
                "ad_slot":"SLOT_ID_WEAPP_REWARD_VIDEO",
                "date":"2020-04-10",
                "req_succ_count":138250,
                "exposure_count":74771,
                "exposure_rate":0.54083906,
                "click_count":2242,
                "click_rate":0.029984887,
                "income":93883,
                "ecpm":6.790813743
            }
        }
    ],
    "total_num":1
}



# III. Get Weixin Mini Program Advertisement list (get_adunit_list)

You need to add the following GET request parameters to the appropriate interface call address:

parameter Do I have to? Introductions
page yes Back to the next few pages of data
page_size yes When the page returns the number of data entries
ad_slot no Ad space type name
ad_unit_id no Wide ID.

Note: When you need to get a list of all**, you do not need to pass the TAG-type name and TAG-ID;When you need to get a list of a certain type of ad space, just pass the name of the ad space type; When you need to get the data for a ID, just pass the ID.



Returns parameter explaination (get_adunit_list)

parameter Introductions
err_msg Return an error message
ret Error code
ad_slot Ad space type name
ad_unit_id Advertisement ID
ad_unit_name Ad space name
ad_unit_size Ad space size
ad_unit_status Ad space status



Returns the example of a digital packet (get_adunit_list)

{
    "base_resp":{
        "err_msg":"ok",
        "ret":0
    },
    "ad_unit":[
        {
            "ad_slot":"SLOT_ID_WEAPP_REWARD_VIDEO",
            "ad_unit_id":"adunit-e9418ee19XXXXX",
            "ad_unit_name":"rewaXXXX",
            "ad_unit_size":[
                {
                    "height":166,
                    "width":582
                }
            ],
            "ad_unit_status":"AD_UNIT_STATUS_ON",
            "ad_unit_type":"AD_UNIT_TYPE_REWARED_VIDEO",
            "appid":"wx0afc78670fXXXX",
            "video_duration_max":30,
            "video_duration_min":6
        }
    ],
    "total_num":1
}



# IV. Obtain Weixin Mini Program settlement income data and settlement entity information (publisher_settlement)

You need to add the following GET request parameters to the appropriate interface call address:

parameter Do I have to? Introductions
page yes Number of pages returned from data
page_size yes Return number of data entries per page
start_date yes Get the start time of the data yyyy-mm-dd
end_date yes Get the end time of the data yyyy-mm-dd

Please note: As long as it coincides with the start and end of the data obtained, the data corresponding to the settlement interval will be returned.For example, a request for data from 11 February to 26 March would return data from the four clearing areas for the first half of February, the second half of January, and the first half and second half of March.



Returns parameter explaination (publisher_settlement)

parameter Introductions
err_msg Return an error message
ret Error code
body Subject Name
revenue_all Cumulative income
penalty_all Amount of deduction
settled_revenue_all Amounts settled
settlement_list: date Time of data update
settlement_list: zone Date Interval
settlement_list: month Income Month
settlement_list: order 1 = first month, 2 = second month
settlement_list: sett_status 1 = In settlement;2 and 3 = settled;4 = In payment; 5 = Payment has been made
settlement_list: settled_revenue Income settled within the range
settlement_list: sett_no Statement of Payment Number
settlement_list: mail_send_cnt Number of requests for replacement bills of settlement
settlement_list: slot_revenue: slot_id Ad space that generates revenue
settlement_list: slot_revenue: slot_settled_revenue The amount settled for this ad space
total_num Request to return the total number of items



Return packet example (publisher_settlement)

{
    "base_resp":{
        "err_msg":"ok",
        "ret":0
    },
    "body":"深圳市腾讯计算机系统有限公司",
    "penalty_all":0,
    "revenue_all":5178368698,
    "settled_revenue_all":2613696765,
    "settlement_list":[
        {
            "date":"2020-03-25",
            "zone":"2020年3月1日至15日"
            "month":"202003",
            "order":1,
            "sett_status":1,
            "settled_revenue":718926045,
            "sett_no":"XXX",
            "mail_send_cnt":"0",
            "slot_revenue":[
                {
                    "slot_id":"SLOT_ID_WEAPP_BANNER",
                    "slot_settled_revenue":34139443
                },
                {
                    "slot_id":"SLOT_ID_WEAPP_REWARD_VIDEO",
                    "slot_settled_revenue":684786602
                }
            ]
        }
    ],
    "total_num":1
}



# Error code explaination

Error code returns values meaning
45009 The request is too frequent. Please try again later
45010 An invalid interface name
1701 Parameter Error
2009 An invalid traffic master