# Advertising Analytics Data Interface Instructions

Open data interface to all Official Account message templates, Mini Program and game developers. Through the data interface, developers can obtain data similar to the public platform's official website statistics module but more flexible, and can also perform advanced processing as needed.

Please note:

  1. The interface side database only stores data after January 1, 2016, and will not be able to query the previous data, even if it is found, it is not trusted dirty data.

  2. It is recommended that developers save the data in their own database after calling the interface to get the data, so as to maximize the efficiency of access and reduce the unnecessary loss of WeChat side interface calls.

  3. Due to the large amount of data, All interfaces are obtained by pagination, The maximum fetch per page is 90. (eg:total_num For 100, then when the page = 1,page_Size = 10, then return to the first 10Page = 1,page_Size = 20, then return to the previous 20Page = 2,page_Size = 10, then return to Articles 11 to 20)

  4. Ad Bit Enumeration Value Change Dxplaination

    • Since multiple interfaces use ad space parameters, we have made some changes to ensure a consistent experience and readability of the parameters. Name of Type (ad)_slot) Pass the parameter and add the name on the packet back to represent the relevant meaning. The previous parameters slot_id It can also be used and returned. Specifically:
Name of Type (ad)_slot) Type of advertising
SLOT_ID_BIZ_BOTTOM Official Account message template
SLOT_ID_BIZ_MID_CONTEXT Official Account message template advertising
SLOT_ID_BIZ_VIDEO_END Official Account message template
SLOT_ID_BIZ_SPONSOR Official Account message template
SLOT_ID_BIZ_CPS Official Account message template
SLOT_ID_WEAPP_BANNER Mini Program banner
SLOT_ID_WEAPP_REWARD_VIDEO Mini Program Motivation Video
SLOT_ID_WEAPP_INTERSTITIAL Mini Program Screen Advertising
SLOT_ID_WEAPP_VIDEO_FEEDS Mini Program Video Advertising
SLOT_ID_WEAPP_VIDEO_BEGIN Mini Program video before posting
SLOT_ID_WEAPP_BOX Small Program Grid Advertising
SLOT_ID_WEAPP_TEMPLATE Mini Program native template advertising
SLOT_ID_WEAPP_COVER Cover Advertising

# Interface overview

Advertising analysis interface is currently available for obtaining “Public platform Flow Main Some of the advertising data displayed on the Statistics page and the "Public Platform" Flow Main Financial Management”Part of the revenue data displayed on the page, and the list of interfaces related to the Mini Program is as follows:

Interface name use Maximum time span Interface call address (must use https)
publisher_adpos_general Get Mini Program Ad Aggregate Data 90 days https://api.weixin.qq.com/publisher/stat?action=publisher_adpos_general&access_token=ACCESS_TOKEN
publisher_adunit _general Get 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 Mini Programs Ad Space List nothing https://api.weixin.qq.com/publisher/stat?action=get_adunit _list&access_token=ACCESS_TOKEN
publisher_settlement Access to Mini Program Settlement Revenue Data and Settlement of Principal Information nothing https://api.weixin.qq.com/publisher/stat?action=publisher_settlement&access_token=ACCESS_TOKEN

# Interface Call Request Dxplaination

# I. Get Summary Data for Mini Program Ads (publisher_adpos_general)

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

parameter Is it necessary Introductions
Page yes Return page data
Page_Size yes When the page returns the number of data bars
start_Date yes Start time to get data yyyy-mm-dd
end_Date yes End Time for Getting Data yyyy-mm-dd
ad_slot no Advertising Space Type Name

Please note: If you do not pass the ad space type name, data for all types of ad space will be returned by default.


Returns the parameter explaination publisher_adpos_general)

parameter Introductions
err_msg Return an error message
ret Error code
list: slot_id Type ID
list: ad_slot Advertising Space Type Name
list: Date date
list: req_succ_count Pull volume
list: exposure_count Exposure
list: exposure_Rate Exposure rate
list: click_count Number of hits
list: click_Rate click-through rate
list: Income income(Cent)
list: ecpm Advertising thousand exposure revenue(Cent)
summary: req_succ_count Total pull
summary: exposure_count Total exposure
summary: exposure_Rate Total exposure
summary: click_count Total hits
summary: click_Rate Total click rate
summary: Income gross income(Cent)
summary: ecpm Advertising thousand exposure revenue(Cent)
total_num List returns the total number of bars

Returns the digital 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_Number: 1 
}

# II. Get Small Program Advertising Segmentation Data (publisher_adunit _general)

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

parameter Is it necessary Introductions
Page yes Return page data
Page_Size yes When the page returns the number of data bars
start_Date yes Date from which data is acquired yyyy-mm-dd
end_Date yes End Time for Getting Data yyyy-mm-dd
ad_slot no Advertising Space Type Name
ad_unit_id no Wide ID.

Please note: When you need to get the breakdown data of all the advertisement, you do not need to pass the advertisement type name and advertisement idWhen you need to get segmentation data for a certain type of ad space, just pass the ad space type nameWhen you need to get the breakdown data of a Guangzhou ID, only the Guangzhou ID is passed.


Returns the 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 Advertising space name
list: stat_item: ad_slot Advertising Space Type Name
list: stat_item :date Date of data
list: stat_item :req_succ_count Pull volume
list: stat_item :exposure_count Exposure
list: stat_item: exposure_Rate Exposure rate
list: stat_item :click_count Number of hits
list: stat_item :click_Rate click-through rate
list: stat_item :income income
list: stat_item :ecpm Advertising thousand exposure revenue(Cent)
total_num Total number of requests returned

Returns the digital packet example (publisher_adunit _general)

{
    "base_resp:{ 
        "err_msg:"ok", 
        "ret": 0 
    },
    "list":[
        {
            "ad_unit_id":"adunit-9cedd8514XXXX" 
            "ad_unit_Name ":" Motivational Video Long Ad, "
            "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_Number: 1 
}

# 3. Get a list of Mini programs_adunit _list)

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

parameter Is it necessary Introductions
Page yes Return page data
Page_Size yes When the page returns the number of data bars
ad_slot no Advertising Space Type Name
ad_unit_id no Wide ID.

Please note: When you need to get a list of all ads, you don't need to pass the ad type name and ad idWhen you need to get a list of a certain type of ad space, just pass the ad space type nameWhen you need to get the data for a ID, just pass the ID.


Returns a parameter explaination (get_adunit _list)

parameter Introductions
err_msg Return an error message
ret Error code
ad_slot Advertising Space Type Name
ad_unit_id Advertisement ID
ad_unit_Name Advertising space name
ad_unit_Size Advertising size
ad_unit_status Advertising Position 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-A9418E19xx",
            "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_Number: 1 
}

# IV. Access to Mini Program settlement income data and settlement subject information (publisher_settlement)

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

parameter Is it necessary Introductions
Page yes Number of pages returned
Page_Size yes Number of data returned per page
start_Date yes Start time to get data yyyy-mm-dd
end_Date yes End Time for Getting Data yyyy-mm-dd

Please note: As long as there is overlap with the start and end time of the data acquisition, the data corresponding to the settlement interval will be returned. For example, a request for data from February 11 to March 26 will return data for the first half of February, second half of February, first half of March, and second half of March.


Returns the parameter explaination publisher_settlement)

parameter Introductions
err_msg Return an error message
ret Error code
body Subject name
revenue_all Accumulated income
penalty_all Deduction amount
settled_revenue_all Amount settled
settlement_list: Date Data update time
settlement_list: Zone Date interval
settlement_list: month Revenue Month
settlement_list: order 1 = First half, 2. = Second half of the month
settlement_list: sett_status 1 = Settlement2、3 = Settled4 = In payment5 = Paid
settlement_list: settled_revenue Intraband settlement income
settlement_list: sett_no Statement of Account No.
settlement_list: mail_send_CNT Number of requests for replacement statements
settlement_list: slot_revenue: slot_id Revenue-generating advertising space
settlement_list: slot_revenue: slot_settled_revenue The amount of advertising space settlement
total_num Total number of requests returned

Returns the digital packet example (publisher_settlement)

{
    "base_resp:{ 
        "err_msg:"ok", 
        "ret": 0 
    },
    "body": "Shenzhen Tencent Computer Systems Limited,"
    "penalty_all":0,
    "revenue_all":5178368698,
    "settled_revenue_all":2613696765,
    "settlement_list":[
        {
            "date":"2020-03-25",
            "zone": "1-15 March 2020"
            "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_Number: 1 
}

# Error code explaination

Error code return value meaning
45009 Requests are too frequent, Please try later
45010 Invalid interface name
1701 Parameter error
2009 Invalid Traffic Master