Fix empty DFP iframes on responsive websites due to illegal repositioning
Today I'd like to share a recent problem we had in a Drupal project where we were using dfp.module.
We were wondering that from time to time DFP ads were disappearing on some positions.
Moving ads parents containers is the reason
After some investigations we found out that the reason was one of the advertisement's parents containers moving around via JavaScript / jQuery.
We used $.append() to move the container for some screen sizes. But the advertisement within the container recognizes this and clears all its content. As I found out moving the container is not allowed by DFP.
So what can you do to fix this?
First of all ensure that the ad is properly displayed without moving (appending / prepending) the container around. Otherwise you might have over problems (use ?googfc appended to the URL to analyse the reasons using the Google Publisher Console)
If moving the app kills display, then you might switch to the asynchronous mode of DFP ads and execute
- if (typeof googletag != 'undefined') {
- // We have to reload the tags after positioning otherwise they will not display
- // due to Google DFP policies.
- googletag.pubads().refresh();
- }
after the ad was moved. This should revive the ad display.
Julian Pustkuchen, M. Sc. Wirtschaftsinformatik ist passionierter Software- & Webentwickler mit den Schwerpunkten Softwaredesign, Objektorientierung sowie Usability- & Ablaufoptimierung bei webks. Ein weiterer Schwerpunkt ist die Entwicklung im CMS Drupal.
Entwickelt Julian gerade keine Software, fährt er Ski, Mountainbike, spielt Badminton, segelt oder verbringt Zeit mit Freunden.
Dieser Blog dient als sein "öffentlicher Notizblo(ck/g)".
Webbasierte Lösungen? Machen wir!
webks: websolutions kept simple
http://www.webks.de
Dir hat dieser Beitrag geholfen?
Oder du suchst weitere professionelle Unterstützung? Unser Team bietet dir professionelle Dienstleistungen im Web-Development und Drupal CMS Entwicklung!
Comments
Post new comment