2023-05-26
技术小刊
00
js
Page({ onLoad: function (options) { // 监听抖音小程序广告 tt.createInterstitialAd({ adUnitId: 'xxxxx', onClose: function () { console.log('onClose') }, onError: function (err) { console.log('onError', err) }, onReady: function () { console.log('onReady') }, onTap: function () { console.log('onTap') // 发送广告点击信息 tt.reportAnalytics('ad_click', { ad_id: 'xxxxx', ad_name: 'test_ad' }) }, onDownloadStart: function (res) { console.log('onDownloadStart', res) // 发送广告下载开始信息 tt.reportAnalytics('download_start', { ad_id: 'xxxxx', ad_name: 'test_ad' }) }, onDownloadSuccess: function (res) { console.log('onDownloadSuccess', res) // 发送广告下载成功信息 tt.reportAnalytics('download_success', { ad_id: 'xxxxx', ad_name: 'test_ad' }) }, onDownloadFailed: function (res) { console.log('onDownloadFailed', res) // 发送广告下载失败信息 tt.reportAnalytics('download_failed', { ad_id: 'xxxxx', ad_name: 'test_ad' }) }, onInstalled: function (res) { console.log('onInstalled', res) // 发送应用安装信息 tt.reportAnalytics('app_installed', { app_name: 'test_app' }) } }) } })

在上面的示例中,我们使用 tt.createInterstitialAd 创建了一个插屏广告实例。在广告实例的 onTap 回调函数中,我们使用 tt.reportAnalytics 报告了广告点击信息。在广告实例的 onDownloadStart、onDownloadSuccess、onDownloadFailed、onInstalled 回调函数中,我们分别使用 tt.reportAnalytics 报告了广告下载和应用安装的信息

如果对你有用的话,可以打赏哦
打赏
ali pay
wechat pay

本文作者:seek

本文链接:

版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!