簡體   English   中英

Prebid 不呈現具有配置尺寸的廣告

[英]Prebid not render ad with configurated sizes

我正在移動設備上測試 Prebid。 在我的 AdUnit 中,我定義了如下維度:

投標前參數

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

投標前尺寸

在我看來,廣告商不明白廣告是在移動設備上顯示的,也許這就是問題所在。 也許有一個參數我忘記了。

我在 iFrame 中進行了拍賣,也許這就是問題所在。

我使用 4.25 版本。

如果我的帖子不正確或不完整,請告訴我,這是我在 stackoverflow 上的第一篇帖子。

非常感謝您的幫助。

問題已經解決了。 您可以在此處查看詳細信息: https://github.com/prebid/Prebid.js/issues/6307

如果您使用改進數字適配器,只需在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
    });
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM