How to do it

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

http://www.scratch9 9.com/.

1. Open your functions.php file for editing.

2. Enter the following function:

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;

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="http://pagead2.googlesyndication.com/

pagead/show_ads.js">

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!

SEO Secrets Uncovered

SEO Secrets Uncovered

Announcing an important message for Webmasters. Who Else Wants to Generate Massive Traffic and Crank Up the Exposure Their Websites Receive by Tapping Into the Unlimited Power of Today's Top Search Engines? As a webmaster, do you spend time studying the number of hits your website is receiving? Do you worry whether you and your clients are getting the exposure needed?

Get My Free Audio Book


Post a comment