gpt4 book ai didi

javascript - GTM - 有没有办法在执行 enableSyncRendering() 和 enableServices() 后异步呈现广告?

转载 作者:行者123 更新时间:2023-11-30 05:31:35 24 4
gpt4 key购买 nike

我访问受限但可以在 DOM 准备好后在此页面上运行任何代码的网站,已为 GTM 启用同步呈现。

它显式执行 enableSyncRendering() 并同步加载 gtm.js 本身(根据 GTM 文档,enableSyncRendering() 需要它才能发挥作用)。

我需要在 DOM 准备就绪后在此环境中异步呈现广告。是否可以恢复到异步模式?执行 googletag.pubads().enableAsyncRendering(); 不会做任何事情,也不会影响后续的代码执行。


我准备了一个与网站具有相同 GTM 初始化的测试页面,并在 DOM 准备就绪后执行命令以从控制台呈现广告。

行:googletag.pubads().enableSyncRendering(); 静态出现在页面上 enableServices(); 之前

如果我注释掉呈现广告的行。如果我返回行,它不会。

我执行的代码:

googletag.cmd.push(function() { 
googletag.defineSlot('/xxxx/xxx/xx/xxxx/xxxxx', [300, 250], 'div-gpt-ad-xxxxxxxxxxxx-0').addService(googletag.pubads());
googletag.display('div-gpt-ad-xxxxxxxxxxxx-0');
console.log("The ad should have been loaded about... now.");
});

最佳答案

Google 不建议通过 Google 跟踪代码管理器 (GTM) 实现 DFP/GPT。

我收到了来自 Google 发布商支持的回复:

...we don’t recommend using GTM with DFP Tags. At present, we don't have any Help Center article regarding this apart from: https://support.google.com/tagmanager/answer/2787990?hl=en&ref_topic=2772416

We are planning to include the option to use GTM for publisher website in near future but at the moment we don't have any ETA. However you can keep an eye on this Help Center article to keep yourself updated on new releases or for any updates related to DFP.

关于javascript - GTM - 有没有办法在执行 enableSyncRendering() 和 enableServices() 后异步呈现广告?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26643941/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com