Script to detect prohibited content and not display Adsense?

Discussion in 'AdSense' started by Success, Nov 14, 2007.

  1. #1
    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.
     
    Success, Nov 14, 2007 IP
  2. Fka200

    Fka200 Guest

    Best Answers:
    0
    #2
    I'm not sure this exists. Maybe those keyword preview tools...

    Oh yeah... Adsense Preview Tool would probably do the job.
     
    Fka200, Nov 14, 2007 IP
  3. Success

    Success Peon

    Messages:
    101
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    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?
     
    Success, Nov 14, 2007 IP
  4. FairyOfLove

    FairyOfLove Banned

    Messages:
    782
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    0
    #4

    No, There is no such script in existence till now :)
     
    FairyOfLove, Nov 14, 2007 IP
  5. kemus

    kemus Guest

    Messages:
    487
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #5
    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.
     
    kemus, Nov 14, 2007 IP
  6. astup1didiot

    astup1didiot Notable Member

    Messages:
    5,926
    Likes Received:
    270
    Best Answers:
    0
    Trophy Points:
    280
    #6
    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.
     
    astup1didiot, Nov 14, 2007 IP
  7. BonusOnline

    BonusOnline Peon

    Messages:
    678
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I never heard this before, But I do think that's great idea. I will learn to have one in future ^_^
     
    BonusOnline, Nov 14, 2007 IP