0

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

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

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

4

1 回答 1

1

如果您考虑一个空的广告位 = 失败的广告调用:

GPT 参考文档中所述,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
  }
});

希望这会帮助你。

于 2019-10-02T07:43:03.237 回答