javascript - Loading Google adsense after page load -


my website has page loads content using ajax. need append google ads @ content of request conditionally. know google ads doesn't work ajax because makes second request using document.write works before page load complete. thought of hacking document.write , works (atleast in firefox). can please let me know if against google policies.

$.ajax(function(){   .....   success: function(){     document.write = function() {       var script = document.createelement('script');       script.type = "text/javascript";       script.src = location.protocol + "//www.google.com/ads/search/module/ads/3.0/xxxx/n/search.js";       document.getelementsbytagname('head')[0].appendchild(script);     };     var script = document.createelement('script');     script.type = "text/javascript";     script.src = location.protocol + "//www.google.com/adsense/search/ads.js";     document.getelementsbytagname('head')[0].appendchild(script);   }//success end });//ajax end 

fyi: strings hard-coded explanation only.

the violation of google terms , conditions has been discussed in different threads regarding topic ( ads refreshing ). refresh div has google ad inside it example has answer throws light on bit vague ( imo ) google policy.

well, apart google has introduced other tag model handling situation of refreshing ads.

so answer problem lies in new google ad tag called gpt - google publisher tag information on gpt can visit introduction google publisher tag. @ sample google publisher tag

and reloading ads without refreshing whole page


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -