Display AdSense Ads to Search Engines Visitors Only


The problem. It’s a known fact that regular visitors don’t click on ads. Those who do click on ads are, 90% of the time, visitors coming from search engines.

Another problem is Google’s “smart pricing.” Being smart priced means that your click-through rate (CTR) is low and the money you earn per click is divided by between 2 and 10. For example, if a click would normally earn you $1.00, with smart pricing it could earn you as little as $0.10. Painful, isn’t it? Happily, this solution displays your AdSense ads to search engine visitors only, which means more clicks and a higher CTR.

The solution.

  1. Open the functions.php file in your theme.
  2. Paste the following code in it:
    1 function scratch99_fromasearchengine(){
    2 $ref = $_SERVER['HTTP_REFERER'];
    3 $SE = array('/search?', 'images.google.', 'web.info.com', 'search.', 'del.icio.us/search', 'soso.com', '/search/', '.yahoo.');
    4 foreach ($SE as $source) {
    5 if (strpos($ref,$source)!==false) return true;
    6 }
    7 return false;
    8 }
  3. Once done, paste the following code anywhere in your template where you want your AdSense ads to appear. They’ll be displayed only to visitors coming from search engine results:
    1 if (function_exists('scratch99_fromasearchengine')) {
    2 if (scratch99_fromasearchengine()) {
    3 INSERT YOUR CODE HERE
    4 }
    5 }

Code explanation. This hack starts with the creation of a function called scratch99_fromasearchengine(). This function contains a $SE array variable in which you can specify search engines. You can easily add new search engines by adding new elements to the array.

The scratch99_fromasearchengine() then returns true if the visitor comes from one of the search engines containing the $SE array variable.

Sources:

Hot Trending Topics

  1. Display a Random Header Image on Your WordPress Blog
  2. 8 Usability Check-Points You Should Be Aware Of
  3. 8 Useful WordPress SQL Hacks
  4. Display recent post from specific category (WordPress Trick)
  5. Using CSS Sliding Doors in WordPress Navigaton

Comments