微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Prebid 不呈现具有配置尺寸的广告

如何解决Prebid 不呈现具有配置尺寸的广告

我正在移动设备上测试 Prebid。在我的 AdUnit 中,我定义了如下维度:

Prebid parameters

但是,我收到了不同尺寸的广告:

Prebid sizes

在我看来,广告商不明白广告是在移动设备上展示的,也许这就是问题所在。也许是我忘记了一个参数。

我在 iFrame 中进行拍卖,也许这就是问题所在。

我使用的是 4.25 版本。

如果我的帖子不正确或不完整,请告诉我,这是我在 stackoverflow 上的第一篇帖子。

非常感谢您的帮助。

解决方法

问题解决了。您可以在此处查看详细信息:https://github.com/prebid/Prebid.js/issues/6307

如果您使用ImproveDigital适配器,只需在improvedigital: {usePrebidSizes: true}中添加pbjs.setConfig

pbjs.setConfig({ improvedigital: {usePrebidSizes: true} });

我的完整样本在这里:

HTML 页面:

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <script type="text/javascript" src="testmobile.js"></script>
  </head>
  <body>
    <div id="b48fef10-6f72-4f83-9a91-77c42069bd87">
    
    </div>
  </body>
</html>

javascript 代码:

/** add your prebid dll here or in html file **/

let adUnits = [];

let adUnit =
{
    code: "b48fef10-6f72-4f83-9a91-77c42069bd87",mediaTypes: {
        banner: {
          sizes: [[300,100],[320,50],[300,50]]
        }
    },bids: [
    {
        bidder:"onetag",params:{
          pubId:"xxxxxxxxxxxxxxxxx"
        }
    },{
        bidder:"appnexus",params:
        {
            placementId:"xxxxxxxxxxxxxxxxx"
        }
    },{
        bidder:"improvedigital",params:
        {
            placementId:"xxxxxxxxxxxxxxxxx"
        }
    }]
};

adUnits.push(adUnit);

pbjs.que.push(function () {
    pbjs.setConfig({
        debug: true,improvedigital: {usePrebidSizes: true}
    });

    pbjs.addAdUnits(adUnits);
    pbjs.requestBids({
        bidsBackHandler: function (bidResponses) {
        var winningBids = [];

        let ad = pbjs.getHighestCpmBids("b48fef10-6f72-4f83-9a91-77c42069bd87");

        if (ad && ad.length > 0) {
            let idIFrame = "b48fef10-6f72-4f83-9a91-77c42069bd87frame";

            let iFrame = "<iframe id='" + idIFrame + "'"
            + " FRAMEBORDER=\"0\""
            + " SCROLLING=\"no\""
            + " MARGINHEIGHT=\"0\""
            + " MARGINWIDTH=\"0\""
            + " TOPMARGIN=\"0\""
            + " LEFTMARGIN=\"0\""
            + " ALLOWTRANSPARENCY=\"true\""
            + " WIDTH=\"0\""
            + " HEIGHT=\"0\">."
            + " </iframe>"

            document.body.innerHTML += '<div id=b48fef10-6f72-4f83-9a91-77c42069bd87>' + iFrame + '</div>';

            var iframe = document.getElementById(idIFrame);
            var iframeDoc = iframe.contentWindow.document;

            try {
                pbjs.renderAd(iframeDoc,ad[0]['adId']);
            } catch (e) {
                console.log(e);
            }

            winningBids = pbjs.getAllWinningBids();
            console.log(winningBids);
        } 
        else 
        {
          console.log("No bids");
        };
    },timeout: 2000
    });
});

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。