# Advertising preloading interface
Basic library 2.14.1 is supported, lower versions need to do compatibility processing
In the Weixin Mini Program environment, it is possible to load the ad data in advance by calling the wx.preloadAd interface and then create the corresponding ad tags later. ad , ad-custom In this case, the preloaded ad data is automatically used, eliminating the time spent pulling the ad again when the ad tag is created.
# Preloaded example
wx.preloadAd([{
unitId: 'adunit-XXX', // 原生模板广告广告单元
type: 'custom' // 原生模板广告
},
{
unitId: 'adunit-XXX', // banner广告广告单元
type: 'banner' // banner广告
},
{
unitId: 'adunit-XXX', // 前贴广告广告单元
type: 'videoPatch' // 视频前贴广告
},
{
unitId: 'adunit-XXX', // 视频广告广告单元
type: 'video' // 视频广告
}
])
# wx.preloadAd(Array object)
# object parameter
| attribute | type | Default values | Required to fill in | Introductions |
|---|---|---|---|---|
| unitId | string | nothing | yes | Advertising unit id, can be in Weixin Mini Program management background traffic main module new |
| type | string | nothing | yes | 广告单元所属广告位类型 custom原生模板广告 bannerbanner广告videoPatch视频前贴广告 video视频广告 |
# Note
(1) The developer is not aware of whether the preloading is successful, and the ad is used in the same way as no preloading.
2, the advertising unit id and the advertising unit belongs to the advertising type need to match successfully, otherwise it will lead to the normal use of preloaded data.
- Use the preloading interface in suitable scenarios (e.g. pageA invokes preloading, pageB invokes ad display, pageA jumps to pageB), and leave sufficient time for the interface call and ad label creation to reflect the advantages of preloading.
If there is a need to display an ad at the front page, and there is no logic for adding, refreshing, etc., subsequent ads, there is no need to call for preloading.
5, if you need to display ads in the home page, there are new, refresh logic, you can call the preloaded interface in apagejs.
6, the advertising unit preloaded, will bring MP backstage advertising data pull volume growth, there may be decreased exposure phenomenon. It is suggested that developers should pay attention to the variation of the absolute value of exposure.