Several Adsense Slots Insertion With JavaScript -
i need insert several adsense slots in same page using javascript.
as can see in dynamic adsense insertion javascript, it's needed rewrite document.write use global vars google_ad_client, google_ad_slot, etc..
like this: (thanks https://stackoverflow.com/users/188740/johnnyo)
<script> window.google_ad_client = "123456789"; window.google_ad_slot = "123456789"; window.google_ad_width = 200; window.google_ad_height = 200; // container want ad inserted var container = document.getelementbyid('ad_container'); var w = document.write; document.write = function (content) { container.innerhtml = content; document.write = w; }; var script = document.createelement('script'); script.type = 'text/javascript'; script.src = 'http://pagead2.googlesyndication.com/pagead/show_ads.js'; document.body.appendchild(script); </script>
the issue is: if have 1 globla var slot... how can insert several ads in same page using javascript ?
Comments
Post a Comment