javascriptresponsivegoogle-dfp

DoubleClick for Publishers Out-Of-Page Slot with Size Mapping for Responsive sites


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();

Solution

  • 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());