3

Does anyone know how to target an out of page ad slot with the Google sizeMapping object for serving responsive ads?

I've tried using "Out-of-page" as the size, but it's not working.

var outOfPageMapping = googletag.sizeMapping().addSize(['out-of-page']).
    addSize([0, 0], ['Out-of-page']).
    addSize([1000, 0], []).
    build();

1 Answer 1

4

Well, after I refined my google search to include "out-of-page", in quotes, I was able to find a Google Group for DFP with the answer!

https://productforums.google.com/forum/#!topic/dfp/OqW_uLU9TJ0

Thanks to Nico Hiort af Ornas, and Rajkumar of Google Support!

Here is Rajkumar's response to Nico's inquiry. I tested, it works:

I read through the post and yes, DFP supports responsive design for out-of-page ad units and you can call defineSizeMapping() function on defineOutOfPageSlot(). You will just need to add the size [1, 1] to the sizeMapping function. Here is a sample design:

 var sizeMapping = googletag.sizeMapping().
       addSize([0, 0], []).
       addSize([1210, 0], [1, 1]).
       build();


 googletag.defineOutOfPageSlot('...','...').defineSizeMapping(sizeMapping).addService(googletag.pubads());
3
  • var mapMastcatfish = googletag.sizeMapping(). addSize([0, 0], [[970, 90], [728, 90], [970, 250]]). addSize([1210, 0], [1, 1]). build(); Sep 21, 2017 at 12:44
  • 1
    googletag.defineOutOfPageSlot('/10176910/CatFishHead','catfish_ad').defineSizeMapping(mapMastcatfish).addService(googletag.pubads()); Sep 21, 2017 at 12:45
  • Are you refreshing the page after you change the browser window size? Sep 21, 2017 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.