繁体   English   中英

我的网站上有两个Google广告,第一个广告只会在第二个广告在那里的情况下显示

[英]I have two google ads on my website, the first one will only show if the second one is there

我已经在我的网站顶部和主页的左侧边栏中放置了一个google广告。

我尝试删除左侧的侧边栏,但是当我这样做时,顶部的广告没有显示...

我一直在查看代码以尝试查看第一个广告代码是否存在差异或缺少什么,但是我找不到任何东西,也无法解释为什么除非我有第二个左手,否则它不会显示边添加在那里。

我遇到显示问题的页面顶部广告看起来像这样:

<div align="center">
<style type="text/css">
.adslot_1 { width: 320px; height: 100px; }
@media (min-width:500px) { .adslot_1 { width: 468px; height: 60px; } }
@media (min-width:800px) { .adslot_1 { width: 728px; height: 90px; } }
</style>
<ins class="adsbygoogle adslot_1"
    style="display:inline-block;"
    data-ad-client="myGoogleID"
    data-ad-slot="adID"></ins>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>(adsbygoogle = window.adsbygoogle || []).push({});</script>
</div>

然后,始终显示在左侧的广告代码如下所示:

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Seek Adventure In Post Ad -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="myGoogleID"
     data-ad-slot="differentAdID"
     data-ad-format="auto"
     data-full-width-responsive="true"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

如果您想同时看到它们都显示,则可以转到此处的主页。

然后,如果您直接转到这样的子页面之一 该广告将不会展示,因为左侧广告不在我的子页面上。

太大而无法评论:

起初,我得到与@AlexanderHolman在Firefox 67.0.4上的评论相同的结果,我只看到最上面的广告。 我不得不在FF和adblocker插件中禁用内容阻止程序,所以也许您遇到了类似的情况。

但是后来我想我注意到了一些可以指示您正确方向的东西:在主页上时,在末尾附加了额外的<ins><iframe>标记,这意味着您正在为主页实现一些特殊的逻辑。 我还注意到,直接导航到讨论与从主页导航之间存在区别:请看一下:

//Direct navigation
<div id="app" class="App affix App--discussion">

//Navigate from home page
<div id="app" class="App affix hasPane App--discussion" style="">

因此,我没有遍历页面代码(有很多),但是希望这可以引导您找到正确的答案。

ps Javascript代码未缩小,可能未摇晃树

由于我不必填写您网站的完整代码,因此需要一些问答环节来评估您的答案

请执行以下步骤-

  1. 将第一种广告样式的style="display:inline-block更改为style="display:block ,然后检查是否解决了问题

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM