Search code examples
javascriptiframegoogle-dfp

Google DFP - Safeframe - Exapanding Ad


HELP!!

I am in need of some example code on how to get an custom expanding ad to work in google DFP. Or just a simple example on how to call a javascript function on the parent page from DFP to expand the ad.

I know that enableSyncRendering(); loads the ads out of the iframe but then it take longer for the page to load since we have more then one ad on the page.

I have read from here, https://support.google.com/dfp_premium/answer/6023110?hl=en, that i can use safeframes and not have to do enableSyncRendering();. But every time i do the creative just loads into a 1x1 iframe from dfp and i cant bust out..

THANKS!!


Solution

  • All of the examples that are compatible with DFP are available here: http://publisherconsole.appspot.com/safeframe/creative-preview.html

    I've managed to get the expansion working (I wanted push which isn't supported by DFP) so if you've followed the examples - I can only suggest that you're targeting a 1x1 advert and so that default advert size is 1x1 pixels.

    The example page was a little difficult to follow at first -but you can literally just include the whole "Creative content" into a custom advert and it'll work as shown (as long as you set a 500x500 ad slot)