【问题标题】:Hide Google Adsense banner when there's no advertisments on Website网站上没有广告时隐藏 Google Adsense 横幅
【发布时间】:2019-08-12 04:11:30
【问题描述】:

我在尝试将 Google Adsense 集成到我的 Weather Website 时遇到了一些问题。

  1. Google 横幅正在运行,但运行不佳。有时,除了空白横幅外,它不显示任何内容。就像这张照片:Picture

  2. 第一个问题让我想到在没有加载广告时隐藏横幅。我找到了一个将data-ad-format="auto" 添加到横幅标签的解决方案。但我需要为移动设备自定义横幅尺寸。如果我使用data-ad-format="auto",我将无法自定义横幅的尺寸。

有人对此有解决方案吗?没有广告时隐藏横幅?

非常感谢!

【问题讨论】:

  • 如果在 CSS 中使用 display:none 没有广告,你能把它放在一个 div 中并使用 JavaScript 隐藏整个 div 吗?
  • 如何检查广​​告是否存在?横幅标签仍然存在,只是在横幅(iframe)标签内的body标签中没有任何内容。由于 iframe #document >html>body 结构,我无法将 css 选择器用于正文
  • 默认情况下,如果没有匹配的广告,Google 会尝试合拢广告单元。您能检查一下该广告单元的设置吗?或者,您可以提供要在广告位置显示的图像。 support.google.com/adsense/answer/113262
  • 有什么更新吗?我有同样的问题。我们使用 googletag.pubads().collapseEmptyDivs(true) 为我们的客户提供了一个可行的解决方案,但它仅适用于 www.googletagservices.com。 Google Adsense 有类似的解决方案吗?

标签: adsense adsense-api adsense-anchor-ads


【解决方案1】:

我遇到这个问题已经有一段时间了,首屏上方的第一个广告单元没有折叠(在 Adsense 中设置了折叠),但首屏下方的广告会折叠。我已经读过,如果您将它与 Google Ad Manager 集成,它会起作用,尽管我还没有时间测试它

【讨论】:

  • 我已经对此进行了测试,可以确认它在迁移到 GAM 后会崩溃
猜你喜欢
  • 1970-01-01
  • 2015-12-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多