信息流广告是在头条中显示,抖音不支持
但是抖音支持插屏和激励广告,先进后台创建相应的广告位,
创建完后复制广告id
1、插屏广告
const interstitialAd = tt.createInterstitialAd({ adUnitId: "广告id", }); interstitialAd .load() .then(() => { interstitialAd.show(); }) .catch((err) => { console.log(err); });
2、激励广告
Page({ onLoad() { // 创建实例 this.ad = tt.createRewardedVideoAd({ adUnitId: "广告id", }); // 监听错误 this.ad.onError((err) => { tt.hideLoading(); switch (err.errCode) { case 1004: // 无合适的广告 break; default: // 更多请参考错误码文档 } }); // 监听视频播放完成 this.ad.onClose((data) => { tt.hideLoading(); if (data.isEnded) { console.log("观看了", data.count, "个视频"); } else { console.log("未观看完视频"); } }); // do other thing // 卸载 close 事件监听 this.ad.offClose(closeHandler); // 预加载资源 this.ad.load(); }, // 处理用户点击 handleClick() { tt.showLoading(); this.ad.show(); }, });官方文档地址:https://developer.open-douyin.com/docs/resource/zh-CN/mini-app/develop/api/open-interface/ads/rewarded-video/tt-createRewardedVideoAd
网友回复