小程序3种广告
1. Banner广告
div class="margin-xs padding-xs radius bg-white" ad unit-id="adunit-91f767d951338851" class="radius"/ad /div复制代码2. 插屏广告
data() { return { interstitialAd: null }},onLoad() { // 在页面onLoad回调事件中创建插屏广告实例 if (wx.createInterstitialAd) { console.log('wx.createInterstitialAd') this.interstitialAd = wx.createInterstitialAd({ adUnitId: 'adunit-7487758745f99b14' }) } if (this.interstitialAd) { this.interstitialAd.show().catch((err) = { console.error(err) }) } },复制代码3. 激励视频广告
data() { return { videoAd: null }},onLoad() { // 在页面onLoad回调事件中创建激励视频广告实例 if (wx.createRewardedVideoAd) { this.videoAd = wx.createRewardedVideoAd({ adUnitId: 'adunit-296656170310d2cd' }) } // 用户触发广告后,显示激励视频广告 if (this.videoAd) { this.videoAd.show().catch(() = { // 失败重试 this.videoAd.load() .then(() = this.videoAd.show()) .catch(err = { console.log('激励视频 广告显示失败') }) }) }},复制代码声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。

