Is there any ad script which check if individual page for prohibited content before displaying the Adsense code? For example, i noticed that ezinearticles display Adsense for 90% of their pages. But if the page contains gambling or adult content, Adsense is replaced with other ads. I am looking for a similar solution.
I'm not sure this exists. Maybe those keyword preview tools... Oh yeah... Adsense Preview Tool would probably do the job.
No, the preview tool is not a soluton. Maybe I should explain further... For example, an article site has 90% allowed content but there some gambling/adult content. Is there a script that will detect prohibited content and not display the Adsense code on those pages?
Easy to write though. Just have the script search through all the words and look for 'bad' words, like say gambling, porn, pron, and I'm sure you can think of 100 more. If any bad word is there, don't display adsense. To have this work you'd need to have the content be in a variable. <? function ad($bad) { if ($bad == 0) { return $adsense; } else { return $otherads; } } $content= "This is my site's content!"; $adsense='Place adsense code here!';// Be sure to keep the apostrophes $otherads='Place other ads here'; // Be sure to keep the apostrophes $bad='porn gambling drugs'; // Space seperated, as many as you want. // DO NOT EDIT // $badarr=explode(" ",$bad); // Makes array $badarr with all the $bad words foreach ($badarr as $each) // Loops through $badarr, using $each as the individual word { if(preg_match($content,$each)) { $bad=1; // This is so I know that this content has a bad word. } } ?> PHP: Just add that code to your page, and then, wherever you want an ad, place <?ad($bad);?> PHP: I haven't tested this yet. Shoot me a PM if you need more help.
Yes, this is rather simple. If you manage your ads through an ad manager or ad teiring script you'll see many have options to search out keywords on webpages to prevent certian ad codes from being displayed.