英文:
Prebid.js GPT integration: How GPT renders prebid winner
问题
我正在尝试理解呈现(最终)流程:
在Prebid.js Hello World示例中,有一个简单的集成:
- 不要初始化GPT。
- 进行拍卖,选择获胜者。
- 使用获胜者的详细信息(价格等)设置GPT定位。
- 刷新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:
- Do not init GPT.
- Make auction, select winner.
- Set GPT targeting using winner details (price etc)
- 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:
<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>
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论