javascript - Display Google AdSense ads to search engine visitor only -
i'm using below blogger/weebly code displaying adsense ads search engine visitor.
code not working...
ads not showing...
whats wrong code?
<script type="text/javascript"> if (document.referrer.match(/google|yahoo|bing|altavista|digg/)) { google_ad_client = "xx-xx-xxxxxxxxxxxxxxxxxx"; /* xxxxxxxx xxxxxx xxx xxx xxx xx xxxxxx */ google_ad_slot = "xxxxxxxxxxxxxx"; google_ad_width = xxx; google_ad_height = xxx; var script = document.createelement("script"); script.setattribute("src", src); document.getelementsbytagname("head")[0].appendchild(script); } else { // show visitors not referred search engine } </script>
please me, sir. thanks.
var script = document.createelement("script"); script.setattribute("src", src); // problem. src variable doesn't exist document.getelementsbytagname("head")[0].appendchild(script);
this code correct. adds script
element head
. problem src
variable not defined anywhere.
Comments
Post a Comment