我的小游戏买量人数已经过了1000,流量主已开通,相关广告id也配好了,为什么拉取不了广告?

小游戏 文章 2022-01-10 20:00 837 0 全屏看文

AI助手支持GPT4.0

我的小游戏买量人数已经过了1000,流量主已开通,相关广告id也配好了,为什么拉取不了广告?The number of people who bought my mini game has exceeded 1,000, the traffic master has been activated, and the relevant advertisement id has been allocated. Why can't I pull the advertisement?

我的小游戏买量人数已经过了1000,流量主已开通,相关广告id也配好了,为什么拉取不了广告?

我的小游戏买量人数已经过了1000,流量主已开通,相关广告id也配好了,为什么拉取不了广告 appid:wxdf307b07af8c13d0

The number of people buying my games has exceeded 1000, the traffic owner has opened, and the relevant advertising ID has been equipped. Why can't I get the advertising appid: wxdf307b07af8c13d0

回答:

小游戏运营专员 - 宏:

返回的错误码是什么?

Peter:{errMsg: "no advertisement", errCode: 5047}
errCode: 5047
errMsg: "no advertisement"
__proto__: Object
Peter:VM16 WAGame.js:2 Unhandled promise rejection {errMsg: "no advertisement", errCode: 1002}(env: Windows,mg,1.05.2112141; lib: 2.21.2)
Peter:public createBannerAD(adUnitId: string, place?: ADPLACE, callback?: Function) {
        console.log("banner广告");
        place = place ? ADPLACE.DOWNMID : place;
        if (!(cc.sys.platform === cc.sys.WECHAT_GAME)) {
            callback && callback(false);
            return null;
        }
        //先通过判断基础版本号再使用
        let ret = this.compareVersion(bannerADVersion);
        if (ret < 0) {
            wx.showModal({
                title: '提示',
                content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后再使用该功能。',
            })
            callback && callback(false);
            return null;
        }
        let ad = wx.createBannerAd({
            adUnitId: adUnitId,
            adItervals: 30,
            style: {
                left: 0,
                top: 0,
                width: 300,
                height: 80,
            }
        });
        ad.show();
        ad.onError((errMsg, errCode) => {
            callback && callback(false);
            callback = null;
            console.log('拉取广告牌失败' + 'errMsg:', errMsg, 'errCode:', errCode);
        })
        ad.onResize((size) => {
            console.log('resize:', size);
            let setSize = this.setBannerPlace(size, place);
            ad.style.left = setSize.left;
            ad.style.top = setSize.top;
        })
        return ad;
    }
Peter:banner:['adunit-e00c5dec6dfb0dd9'],
Peter:box:['adunit-b2102ae784ef3fc0']
Peter:box是customAD
Peter:游戏广告代码没有问题,别的小游戏用的这一套代码能用,可能是我开通流量主后还没有等生效就上传了游戏。是不是流量主还没有生效的原因?
小游戏运营专员 - 宏:https://developers.weixin.qq.com/minigame/dev/api/ad/BannerAd.onError.html
检查一下id,大小写、空格之类的
Jx:

一样啊1002 啥情况

Peter:

 public createCustomAD(adUnitId: string, callback?: Function, top?: number) {

        console.log("Custom广告");


        if (!(cc.sys.platform === cc.sys.WECHAT_GAME)) {

            callback && callback(false);

            return null;

        }

        //先通过判断基础版本号再使用

        let ret = this.compareVersion(customADVersion);

        if (ret < 0) {

            wx.showModal({

                title: '提示',

                content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后再使用该功能。',

            })

            callback && callback(false);

            return null;

        }

     

        let info = wx.getSystemInfoSync();

        let width = info.windowWidth;

        let height = info.windowHeight;

        top = top ? height/2 : 250;

        let ad = wx.createCustomAd({

            adUnitId: adUnitId,

            style: {

                left: 0,

                top: height - top,

                width: width, // 用于设置组件宽度,只有部分模板才支持,如矩阵格子模板

                fixed: false // fixed 只适用于小程序环境

            }

        });

        ad.onLoad((res) => {

            if (!ad.isShow) {

                console.log('原生模板广告show');

                ad.show();

            }

            console.log('原生模板广告onLoad', JSON.stringify(res));

        })

        ad.onError((errMsg, errCode) => {

            callback && callback(false);

            callback = null;

            console.log('原生模板广告onError' + 'errMsg:', errMsg, 'errCode:', errCode);

        })

        ad.onClose((res) => {

            console.log('原生模板广告onClose', JSON.stringify(res));

        })


        ad.show();

        return ad;

    }


-EOF-

AI助手支持GPT4.0