Ad stopped showing up. Ad unit failed to fetch. Other ads are working normally but with different code.

StackOverflow https://stackoverflow.com/questions/16418576

Question

One ad unit just stopped to work and after trying to generate new code it is still not working. When I use google console it is just showing warning Ad unit failed to fetch. Other 3 ads are working normally. They are inserted before I started to work on this project.

New ad code is generated like header

<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);
})();
</script>

<script type='text/javascript'>
googletag.cmd.push(function() {
googletag.defineSlot('/6000854/R300x250_L', [300, 250], 'div-gpt-ad-1367703773182-0').addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>

body

    <!-- R300x250_L -->
<div id='div-gpt-ad-1367703773182-0' style='width:300px; height:250px;'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1367703773182-0'); });
</script>
</div>

Old code is generated like header

<script type='text/javascript' src='http://partner.googleadservices.com/gampad/google_service.js'></script>

    <script type='text/javascript'>
        GS_googleAddAdSenseService("ca-pub-2838961657718357");
        GS_googleEnableAllServices();
    </script>

    <script type='text/javascript'>
        GA_googleAddSlot("ca-pub-2838961657718357", "Top728x90");
        GA_googleAddSlot("ca-pub-2838961657718357", "Right300x250");
        GA_googleAddSlot("ca-pub-2838961657718357", "Right300x250Bottom");
    </script>

    <script type='text/javascript'>
        GA_googleFetchAds();
    </script>

body

<!-- Right300x250Bottom -->
        <script type='text/javascript'>
            GA_googleFillSlot("Right300x250Bottom");
        </script>

Is there maybe conflict because of diferent tags or code NOTE: I am just wordpress front end developer, I don't have access to google DFP services and I am not generating tags or code

Was it helpful?

Solution

EDIT: Based on this discussion it looks like using the old GAM tags with GPT tags may now be an issue (just recently) http://productforums.google.com/forum/#!topic/dfp/snK7znwUMBE

I think you should convert the GAM tags to to GPT tags and use just the DFP GPT tags if possible to stop this happening... its most probably a conflict between the two scripts and depending on the order they get loaded the GPT tags may not work...

ORIGINAL: I just tried your code and two ads showed as expected. So there does not appear to be any conflicts using both scripts at the same time.

Potentially you have been refreshing the page so many times that there are no ads that will be displaying for you through DFP anymore because of rate limits? That is just a wild guess though. If I refresh the page a lot I do get the failed to fetch message every now and then in the console so I think it is probably just a rate limit and something that a normal user will not have a problem with.

This is the code that I am using, two 300x250 ads show on the page so everything is working correctly.

<html>
<head>
    <title>DFP TEST</title>

    <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);
    })();
    </script>

    <script type='text/javascript'>
    googletag.cmd.push(function() {
    googletag.defineSlot('/6000854/R300x250_L', [300, 250], 'div-gpt-ad-1367703773182-0').addService(googletag.pubads());
    googletag.pubads().enableSingleRequest();
    googletag.enableServices();
    });
    </script>

<script type='text/javascript' src='http://partner.googleadservices.com/gampad/google_service.js'></script>

    <script type='text/javascript'>
        GS_googleAddAdSenseService("ca-pub-2838961657718357");
        GS_googleEnableAllServices();
    </script>

    <script type='text/javascript'>
        GA_googleAddSlot("ca-pub-2838961657718357", "Top728x90");
        GA_googleAddSlot("ca-pub-2838961657718357", "Right300x250");
        GA_googleAddSlot("ca-pub-2838961657718357", "Right300x250Bottom");
    </script>

    <script type='text/javascript'>
        GA_googleFetchAds();
    </script>

</head>
<body>

    <!-- R300x250_L -->
<div id='div-gpt-ad-1367703773182-0' style='width:300px; height:250px;'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1367703773182-0'); });
</script>
</div>

<!-- Right300x250Bottom -->
        <script type='text/javascript'>
            GA_googleFillSlot("Right300x250Bottom");
        </script>

</body>
</html>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top