【问题标题】:Does Google Publisher Tag have a slot render fail event?Google Publisher Tag 是否有槽渲染失败事件?
【发布时间】:2019-09-26 05:31:24
【问题描述】:

在成功的情况下,他们有一个事件

googletag.pubads().addEventListener('slotRenderEnded', function(event) {
  console.log('Slot has been rendered:');
  console.log(event);
});

但是如何知道插槽渲染是否失败?

【问题讨论】:

  • 失败是什么意思?什么时候没有广告返回(为空)?
  • 是的,我想知道是空的还是没有广告项。如果那样,我将添加其他组件。

标签: javascript google-ad-manager


【解决方案1】:

如果您认为空广告位 = 广告调用失败:

正如GPT Reference Documentation 中详述的那样,SlotRenderEnded 能够告诉您 isEmpty = true,这意味着 adcall 没有返回任何内容。

为此,您可以使用例如:

googletag.pubads().addEventListener('slotRenderEnded', function (event) {
  if(event.isEmpty) {
     //whatever you need to do if the adcall ended empty
  }
  else {
     //what to do if the adcall is not empty
  }
});

希望这会对你有所帮助。

【讨论】:

  • 非常感谢。这就是我想要的:)
猜你喜欢
  • 2013-03-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-08-13
  • 1970-01-01
  • 1970-01-01
  • 2022-08-16
相关资源
最近更新 更多