Prebid.js GPT集成:GPT如何渲染Prebid获胜者

huangapple go评论80阅读模式
英文:

Prebid.js GPT integration: How GPT renders prebid winner

问题

我正在尝试理解呈现(最终)流程:
Prebid.js Hello World示例中,有一个简单的集成:

  1. 不要初始化GPT。
  2. 进行拍卖,选择获胜者。
  3. 使用获胜者的详细信息(价格等)设置GPT定位。
  4. 刷新GPT,广告服务器尝试超越价格,在成功时,它将发送回一个新的获胜创意。最有趣的是失败的情况 - 广告服务器发送回一些带有定位的代码,结果我看到Prebid获胜者呈现在GPT块内。

我在prebid.js源代码中进行了搜索,但在定位/刷新之后,prebid.js和GPT之间没有交互。GPT如何知道它将呈现什么(以及广告内容)。

英文:

I am trying to understand the rendering (final) flow:
In Prebid.js Hello World example there is simple integration:

  1. Do not init GPT.
  2. Make auction, select winner.
  3. Set GPT targeting using winner details (price etc)
  4. Refresh GPT, Ad Server trying to beat the price, on the success, it will send back a new winner creative. Most interesting is the case of fail - AdServer sends back some code with targeting, and as a result, I see the prebid winner rendered inside of GPT block.

I did search in prebid.js sources but there is no interaction between prebid.js and GPT after targeting/refresh. How GPT knows what it will render (and the ad content).

答案1

得分: 1

当Google Ad Manager中的头部竞价中标时,GAM会使用代码响应,该代码将循环返回到Prebid.js以渲染创意。

如果您根据Prebid文档在Ad Manager中设置了Prebid创意,那么页面上提供的创意应该如下所示:

<script src="https://cdn.jsdelivr.net/npm/prebid-universal-creative@latest/dist/creative.js"></script>
<script>
  var ucTagData = {};
  ucTagData.adServerDomain = "";
  ucTagData.pubUrl = "%%PATTERN:url%%";
  ucTagData.targetingMap = %%PATTERN:TARGETINGMAP%%;
  ucTagData.hbPb = "%%PATTERN:hb_pb%%";

  try {
    ucTag.renderAd(document, ucTagData);
  } catch (e) {
    console.log(e);
  }
</script>

ucTag.renderAd的代码可以在Prebid Universal Creative存储库中找到。对于桌面横幅,renderAd()从GAM的定向键值中获取Prebid内部广告ID(上述创意中的TARGETINGMAP宏),然后通过调用Prebid.js的window.pbjs.renderAd()或在跨域情况下通过postMessage向Prebid.js请求广告,并在新的iframe中渲染它。

英文:

When a header bidding bid wins auction in Google Ad Manager, GAM responds with the code which loops back to Prebid.js to render the creative.
If you set up your Prebid creatives in the Ad Manager per Prebid documentation then the creative served on the page should look like this:

&lt;script src = &quot;https://cdn.jsdelivr.net/npm/prebid-universal-creative@latest/dist/creative.js&quot;&gt;&lt;/script&gt;
&lt;script&gt;
  var ucTagData = {};
  ucTagData.adServerDomain = &quot;&quot;;
  ucTagData.pubUrl = &quot;%%PATTERN:url%%&quot;;
  ucTagData.targetingMap = %%PATTERN:TARGETINGMAP%%;
  ucTagData.hbPb = &quot;%%PATTERN:hb_pb%%&quot;;

  try {
    ucTag.renderAd(document, ucTagData);
  } catch (e) {
    console.log(e);
  }
&lt;/script&gt;

The code for <code>ucTag.renderAd</code> is available in the Prebid Universal Creative repo. <code>renderAd()</code> for a desktop banner gets the Prebid internal ad ID from GAM targeting key-value (the TARGETINGMAP macro in the creative above) and renders the ad either by calling Prebid.js's window.pbjs.renderAd() or in a cross-origin scenario requests the ad from Prebid.js via postMessage and renders it inside a new iframe.

huangapple
  • 本文由 发表于 2020年1月6日 20:45:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/59612373.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定