How to do it

Google Sniper

Search Engine Traffic Guide

Get Instant Access

In order to complete this recipe, we need to detect if the visitor comes from a search engine or not. I got these tips from my friend Stephen Cronin. You can read Stephen's blog at


1. Open your functions.php file for editing.

2. Enter the following function:

function scratch99_fromasearchengine(){ $ref = $_SERVER['HTTP_REFERER']; $SE = array('/search?', '',

,,,,search.,/ '', '', '/search/', '.yahoo.'); foreach ($SE as $source) { if (strpos($ref,$source)!==false) return true;

return false;

3. Save functions.php and open the file where you want you Adsense ads to be displayed. Enter the following code:

if (function_exists('scratch99_fromasearchengine')) { if (scratch9 9_fromasearchengine()) {

echo '<script type="text/javascript"><!--google_ad_client = "pub-XXXXXXXXXXXXXXXX"; google_ad_slot = "46 68 915978"; google_ad_width = 468; google_ad_height = 60; //--> </script>

<script type="text/javascript" src="


4. Save your file and visit your blog. No ads are displayed because you aren't coming from search engine results pages. Now, Google your blog and ads are displayed!

Was this article helpful?

0 0
SEO Made Easy

SEO Made Easy

Discover How To Get Your Sites On Top of The Search Engines So You Can Generate More Leads and Sales, Introducing... SEO Made Easy'. You'll discover why search engine optimization is important and why you should be optimizing are your pages so people can find your site.

Get My Free Ebook

Post a comment