iframe - DoubleClick For Publishers (DFP) : Serving expandable ads using asynchronous GPT -
i'm using asynchronous gpt serve expandable ad, creative getting cut off because seems asynchronous tags not friendly iframes.
i used dom function escape iframe parent, think can't because creative rendering before rendering of page.
this sample of tags
<script type='text/javascript' src='http://www.googletagservices.com/tag/js/gpt.js'> googletag.pubads().definepassback('6917646/h24info/h24info_atf_home_728x90', [[728,90]]).setclickurl('[insert_click_counter_here]').display(); googletag.pubads().enablesinglerequest(); googletag.pubads().addeventlistener('slotrenderended', function(event) { var sas = document.getelementbyid("sas_format_33008"); var gpt = document.getelementbyid("gpt_unit_6917646/h24info/h24info_atf_home_728x90_1_ad_container"); gpt.style.position = "absolute"; gpt.style.zindex = "100"; sas.style.height = "90px"; }); googletag.enableservices(); </script>
is there can me please ?
another option use post messages. need put event listener in main site. this:
<script type="text/javascript"> (function() { function onmessagereceived(e) { if ( //e.origin !== 'http://tpc.googlesyndication.com' || typeof e.data !== 'object' || typeof e.data.id !== 'string' || e.data.cmd !== 'setstyle' || typeof e.data.params !== 'object' ) { return; } var frame = document.getelementbyid(e.data.id); if (frame === null) { return; } object.keys(e.data.params).foreach(function(param) { frame.style[param] = e.data.params[param]; }); } if (window.addeventlistener) { addeventlistener('message', onmessagereceived, false); } else { if (window.attachevent) { attachevent('onmessage', onmessagereceived); } else { window.onmessage = onmessagereceived; } } })(); </script>
then in creative code, have call event listener resize elements need expand. example:
<script> (function(){ if (window.top.postmessage) { window.top.postmessage({ cmd: 'setstyle', id: 'div-of-the-banner', params: { display: 'block', height: '600px', width: '300px' } }, '*'); } })(); </script>
you may need call resize script several times if more 1 element fixing size of creative.
Comments
Post a Comment