Hide Adsense from Social Traffic

The way to hide Adsense from social traffic is complex. The concept here is that ‘Search Traffic” is motivated and focused, and therefore more likely to click, and ‘Social Traffic’ is just that, the surfers want to be amused or entertained, not educated or fulfilled.
- Show Your Adsense ads to Focused Search Traffic
Google Adsense will penalize you (called Smart Pricing) with low value click commissions if you send them lots of traffic that doesn’t buy anything, so there is a very good case to show your Adsense ads only to focused Search Traffic!
This code will display an Adsense ad (inside gooad.htm) in an ‘I’ frame to search traffic, or else show an alternative banner to social traffic
<script type="text/javascript">
var myArray = [
'/search?',
'.yahoo.',
'search.',
'/search/',
'images.google.',
];
var i, numDomains = myArray.length, found = false;
for (i = 0; i < numDomains; i++) {
if (document.referrer.indexOf(myArray[i]) > -1) {
found = true;
}
}
document.write((found ? ‘<iframe src=”http://mysite.com/gooad.htm” width=”468″ height=”60″ scrolling=”no” border=”0″ marginwidth=”0″ style=”border:none;” frameborder=”0″></iframe>‘ : ‘<a href=”http://yourID.therichboytes.click2sell.eu/campaign?id=XX352″ target=”_blank”><img src=”http://mysite.com/img/richboy.jpg” alt=”Work At Home - Earn $200+ Per Day At Home” border=”0″></a>‘));
</script>
The Red code is your adsense code, where gooad.htm contains the usual Adsense Script, and the green code is the alternate banner code
You can do the same with a PHP script like this:
<?php
function searchengine(){
$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;
}
if (function_exists(’searchengine’)) {
if (searchengine()) {
echo “<script type=\”text/javascript\”><!–
google_ad_client = \”pub-070534895542XXXX\”;
/* OrgBan468×60 11/07 */
google_ad_slot = \”8587849573\”;
google_ad_width = 468;
google_ad_height = 60;
//–>
</script>
<script type=\”text/javascript\”
src=\”http://pagead2.googlesyndication.com/pagead/show_ads.js\”>
</script>“;
}
else echo”<a href=\”http://yourID.therichboytes.click2sell.eu/campaign?id=23352\” target=\”_blank\”><img src=\”http://mysite.com/img/richboy.jpg\” alt=\”Work At Home - Earn $200+ Per Day At Home\” border=\”0\”></a>“;
}
?>
The above script will also display either Adsense or a Banner as is appropriate…. either displaying adsense to surfers, or doing its job: to hide adsense from social traffic.
- Please notice that where the Google ad script is included in PHP you need to ‘Escape’ all the double quotes - like this: script=”ad text” must be edited to read script=\”ad text\” and change any ’slanted’ quotes like ‘ and “ to vertical quotes like these ” ‘
WordPress and some other programs will turn the quotation marks into ’smart quotes’ and stuff up the code, so be aware of this and make sure both single and double quotes are all vertical, not sloping when you ‘paste’ in code!