【问题标题】:Prebid not render ad with configurated sizesPrebid 不呈现具有配置尺寸的广告
【发布时间】:2021-02-16 10:14:27
【问题描述】:

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

Prebid parameters

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

Prebid sizes

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

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

我使用的是 4.25 版本。

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

非常感谢您的帮助。

【问题讨论】:

    标签: javascript ads prebid.js prebid header-bidding


    【解决方案1】:

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

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

    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,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
        });
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-16
      • 1970-01-01
      • 1970-01-01
      • 2016-03-02
      • 2014-06-07
      • 1970-01-01
      • 2018-04-07
      相关资源
      最近更新 更多