Categorized | Adsense

Tags | Adsense

Display Adsense ads to your Search Engine visitors only.

Posted on 13 June 2009 by Raman

Adsense ads to your Search Engine visitors

Now it has been proved that, the clicks we get on oue blogs’ ads are mostly from the people who come from Search Engine and not from our blogs’ regular visitors.

Thus, it will be a better idea to display Adsnse ads to only those coming from Search Engine. This will also prevent your blog from being “Smart Priced”.

For this add this code to your functions.php file -

function scratch99_fromasearchengine(){
$ref = $_SERVER['HTTP_REFERER'];
$SE = array(’/search?’, ‘images.google.’, ‘web.info.com’, ’search.’, ‘del.icio.us/search’, ’soso.com’, ‘/search/’, ‘.yahoo.’);
foreach ($SE as $source) {
if (strpos($ref,$source)!==false) return true;
}
return false;
}

The $SE array is where you specify search engines. You can easily ad new search engines by adding new elements to the array.

Then, paste the following code anywhere on your template where you want your adsense ads to appear. They’ll be displayed only to visitors comming from search engines results.

if (function_exists(’scratch99_fromasearchengine’)) {
if (scratch99_fromasearchengine()) {
INSERT YOUR CODE HERE
}
}

If you enjoyed this post, make sure you subscribe to my RSS feed!

Related posts

1 Comments For This Post

  1. Loans buaa Says:

    is there an wordpress plugin to display adsense ads to search engine visitors only

Leave a Reply

Affiliate Theme Advertise Here
Advertise Here