2

由于我完全是新手,所以这个问题对其他人来说可能很容易。我的广告未在网络上显示(各种横幅、多个位置、未显示)。在www.motoraport.pl/stacje上,我预计右侧会显示 2 个横幅,但插槽是空的。

调试时我得到类似的信息

MRPrawa1    
Slot size: 300x250Format: DivService: DFP
Ad unit did not fetch.
Ad unit did not render.
Ad fetch count: 1
Iframe type: none

Warnings:
Ad unit failed to fetch.

-或者-

MRPrawa1
Slot size: 300x250Format: DivService: DFP

251 ms to fetch creative
Ad unit did not render.
Ad fetch count: 1
Iframe type: none

但是,如果我单击调试控制台Open Creative in New Window,我会看到横幅图像。我认为可能有代码混乱,所以我创建了简单的本地主机页面

<!DOCTYPE html>
<html>
    <head>
        <script type='text/javascript'>
            var googletag = googletag || {};
            googletag.cmd = googletag.cmd || [];
            (function() {
            var gads = document.createElement('script');
            gads.async = true;
            gads.type = 'text/javascript';
            var useSSL = 'https:' == document.location.protocol;
            gads.src = (useSSL ? 'https:' : 'http:') +
            '//www.googletagservices.com/tag/js/gpt.js';
            var node = document.getElementsByTagName('script')[0];
            node.parentNode.insertBefore(gads, node);
            })();

            googletag.cmd.push(function() {
              googletag.defineSlot('/19844765/MRPrawa1', [300, 250], 'div-gpt-ad-1450140062768-3').addService(googletag.pubads());
              googletag.defineSlot('/19844765/MRPrawa2', [300, 250], 'div-gpt-ad-1450140062768-4').addService(googletag.pubads());
              googletag.pubads().enableSingleRequest();
              googletag.pubads().enableSyncRendering();
              googletag.enableServices();
            });
        </script>
    </head>
    <body>
        <!-- MRPrawa1 -->               
        <!-- /19844765/MRPrawa1 -->
        <div id='div-gpt-ad-1450140062768-3' style='height:250px; width:300px;'>
            <script type='text/javascript'>
                googletag.cmd.push(function() { googletag.display('div-gpt-ad-1450140062768-3'); });
            </script>
        </div>
        <!-- /19844765/MRPrawa2 -->
        <div id='div-gpt-ad-1450140062768-4' style='height:250px; width:300px;'>
            <script type='text/javascript'>
                googletag.cmd.push(function() { googletag.display('div-gpt-ad-1450140062768-4'); });
            </script>
        </div>
    </body>
</html>

但问题依然存在。有人可以帮忙吗?

4

1 回答 1

2

经过几天的风吹草动,我意外地发现所有声明在的广告位都<head/>必须在<body/>. 在我的情况下,根据页面的不同,head 中主要声明了 5 个插槽,body 中使用了 1-2 个插槽。不知何故,这导致所有广告都空白。我希望这将有助于其他人通过嵌入 DFP 广告。

于 2016-01-04T22:51:59.247 回答