Responsive Google DFP Ads?

parafly9

Member
Hi all, trying to get my ads to become responsive, and I've followed some guides. Something is clearly off. I'm trying to get my ad in Container Header to pull different sizes depending on size.

This seems to just be pulling 728x90 though, no matter what I do.

Any DFP experts see anything here I'm doing wrong?

Here is the code in Header

Code:
  var mappingAZ_Forum_Leaderboards = googletag.sizeMapping().
        addSize([1100, 0], [970, 90] [728, 90]).
        addSize([750, 0], [[468, 60], [320, 50]]).
        addSize([0, 0], [[320, 50], [300, 50]]).
        build();    

    <!-- New Tags -->
    googletag.defineSlot('/12324148/x_AZ_Forum_Leaderboards', [[728, 90], [320, 50], [970, 90], [468, 60], [300, 50]], 'div-gpt-ad-1604352136414-0').defineSizeMapping(mappingAZ_Forum_Leaderboards).addService(googletag.pubads());

And the code for the ad unit itself which is placed in the Advertising section in the admin CP under "Container Header".

Code:
    <!-- /12324148/x_AZ_Forum_Leaderboards -->
    <div id='div-gpt-ad-1604352136414-0'>
      <script>
        googletag.cmd.push(function() { googletag.display('div-gpt-ad-1604352136414-0'); });
      </script>
    </div>
 
I figured it out. I had some errors in my code (whoops). The first addSize was missing a comma and two brackets around the two ad sizes that could be served. Ttat solved it, working like a charm now.
 
Top Bottom