【问题标题】:Where do I put the adsense code for my MVC app我在哪里放置我的 MVC 应用程序的 adsense 代码
【发布时间】:2015-04-13 03:11:41
【问题描述】:

我刚刚注册了 Adsense,并收到了 Adsense 代码。但是,我不知道将它放在我的 MVC 应用程序的哪里。在我的_layout.cshtml 文件中,我有以下 div 部分:

<div id="bodyContentDiv" class="container body-content">
        <div class="row">
            <div id="bodyDiv" class="col-sm-11">
                @RenderBody()

                <footer>
                    <hr />
                </footer>
            </div>
            <div id="advertisementDiv" class="col-sm-1" style="height: 850px; border-left: 1px solid; border-color: lightgray">
                <br />
                <br />
                <p class="text-muted">
                    Sponsors & Links
                </p>
                <br/>

                <a id="fatbirderAdLink" href="http://www.xxxxxx.com/"><img src="~/Advertising/Fatbirder.png" title="Fatbirder"></a>
                <hr class="advertising"/>
                <a id="birdAndDineAdLink" href="http://www.xxxxx.com/"><img src="~/Advertising/BirdAndDine.png" title="Watch birds and enjoy good food"></a>

            </div>
        </div>
    </div>

我希望 Adsense 广告出现在 ID 为 advertisementId 的 div 中,就在 ID 为 birdAndDineAdLink 的 a 标记下方。但我不知道如何让它出现在那里,或者即使我可以。

我确实尝试将代码粘贴到“birdAndDineAdLink”div 下方,但出现以下错误:

未捕获的错误:找不到容器的响应大小 width=118px 和 data-ad-format=auto

所以我认为我做错了什么。

我选择了响应式 AdSense 广告类型。

【问题讨论】:

    标签: adsense


    【解决方案1】:

    刚刚过去的代码下面的标签

    <a id="birdAndDineAdLink" href="http://www.xxxxx.com/"><img src="~/Advertising/BirdAndDine.png" title="Watch birds and enjoy good food"></a>
    <!-- PASTE ADSENSE BELOW -->
    

    【讨论】:

    • 我实际上在发布这个问题之前尝试过,但是当我这样做时,我收到了这个错误:未捕获的错误:找不到宽度=118px 和 data-ad-format=auto 的容器的响应大小/跨度>
    • 看起来这是来自 Google 的错误消息,说他们找不到宽度为 118 像素的自适应广告。 advertisementDiv 的宽度是多少?您是通过 Google 提出的吗?
    • 广告Div为148px x 850px
    • 我已经尝试了您提供的链接的所有变体,但我仍然收到错误消息。可能需要联系 Google。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-11-03
    • 1970-01-01
    • 2015-09-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多