# Mini Program Video Advertising
Mini Program advertising traffic main operating guidelines:Document address
Developers can use ad Component to create a Mini Program video advertising component, the video advertising component will automatically pull advertising data and display after creation. For the time being only supported in the same layer rendering mode, and does not support nesting
# Ad Size Settings
Mini Programs video ads do not allow direct setting of style properties. The default width is 100% (width: 100%), and the height is automatically calculated proportionally, so developers can set the width of the ad outer component to adjust the size of the ad. The width of the ad outer component is not allowed to be less than 90% of the screen width. When the width is less than 90% the screen width, the width of the video ad component is forced to adjust to 90% of the screen width.
/* The width of the outer assembly can be set to 100% or a specific value */
.adContainer {
width: 100%
}
<view class="adContainer">
<ad unit-id="xxxx" ad-type="video" ad-theme="white"></ad>
</view>
# Ad Theme Style Settings
The Mini Program video advertising component provides black and white theme styles that developers can pass in when creating video ads.ad - theme
Parameter to implement the theme style selection,ad - theme
Parameter is of character string type, optionalwhite
, black
<view class="adContainer">
<ad unit-id="xxxx" ad-type="video" ad-theme="white"></ad>
</view>
<view class="adContainer">
<ad unit-id="xxxx" ad-type="video" ad-theme="black"></ad>
</view>
# Advertising event monitoring
Video ads are automatically pulled after they are created. Developers can use ad Component onload
and onerror
Event Monitor Ad Pull Success or Failure, Can Be Pulled Through onclose
Event listening ads are turned off.
<view class="adContainer">
<ad unit-id="xxxx" ad-type="video" ad-theme="white" bindload="adLoad" binderror="adError" bindclose="adClose"></ad>
</view>
Page({
adLoad() {
console.log('Mini Programs video ads loaded successful')
},
adError(err) {
console.log("Mini Program video ad loading failure," err)
},
adClose() {
console.log('Mini Programs video ads closed')
}
})
# Ad Timing Refresh
Mini Program Video Advertising Component Not Applicable to Timed Refresh Parametersad-intervals