Save your site. Hide Paid Links From Google Bot

Posted By Keith Dsouza On November 12, 2007 @ 4:44 am In How To | 16 Comments

I know the discussion over paid links and Google has been over done. I had suggested a simple trick [1] to overcome being penalized by Google earlier. Here is one more trick that you can use to avoid being penalized by Google. This trick is much better than the nofollow links and will keep both the advertisers and Google happy.

Before we get to the trick lets have a look at why you should use this trick and not a nofollow link.

Publisher the Loser

As a publisher you are caught between selling paid links and following Google standards whichever way you look at it you will be the loser. Many advertisers simply decline to have a nofollow in the links. This on the other hand could get you penalized by Google itself.

So you are caught in the middle of something that you cannot face or fight. You have to give into demands from either one of them. Lose you will but having to decide which way to go is much more difficult.

Why Not Use Nofollow?

Like I said earlier many advertiser are really not going to allow you to use nofollow for paid links, if you are small or medium sized publisher then it gets worse. More of the big time publishers can convince their advertisers to allow them to use nofollow.

Now lets get on to the trick.

What is the trick?

The trick is a simple layer of code, you can use with PHP, ASP, JSP and Javascript to hide or show your advertisements. The eventual result is that they do not display your paid links if Googlebot is visiting your website. In this way you will not be showing those links to the Googlebot and disallowing them to follow those paid links. You keep your advertiser happy and also take precaution against getting banned due to selling paid links.

Lets have a look at the code, its not rocket science but a simple condition you have to put before showing up the ads.

For sites running with PHP as the processing language.

$userAgent = $_SERVER['HTTP_USER_AGENT'];
if(stristr(strtolower($userAgent), 'googlebot') === FALSE) {
    //NORMAL USER BROWSING SHOW THE ADS
    //<!--  Your PAID Ads Code -->
}
else {
    //THIS IS GOOGLE BOT DO NOT SHOW PAID LINKS HERE
}

For sites running ASP as the processing language.

$userAgent = Server.GetVariables("HTTP_USER_AGENT");
 
If Not InStr(LCASE($userAgent), "googlebot) Then
    'display ad code here
Else 
    'do not display ad code here
End If

For sites running JSP as the processing language

<%
String userAgent = request.getHeader( "User-Agent" );
if(userAgent.toLowerCase().indexOf("googlebot") != -1) {
    //display your ads here
}
else {
    //do not display your ads here
}
%>

Common solution for site running any processing language using JavaScript.

if(navigator.userAgent.toLowerCase().indexOf("googlebot") <= -1) {
    //display ads here
}
else {
    //do not display ads here
}

As you can see in the above code examples, first you have to store the user agent in a variable and then make a check it is the Googlebot that is visiting you. If we have Googlebot visiting your site, you simply do not display the ads. You can ofcourse change and add other agents to the list using && operators.

In the above examples I have lower cased all the user agent strings such as to avoid variations in the user agent for Googlebot. It could be GoogleBot, Googlebot, googleBot, googleBOT or anything else. By changing the text to lower case we ensure that we are always searching for googlebot.

This is just a simple trick I suggest to tackle any problems for getting penalized from Google. Before using this I would suggest you contact Google and check their response on it. I should not be held responsible if you use this trick.

If you think this was helpful do leave me your comments on it, I am always looking forward to it.


Article printed from Techie Buzz: http://techie-buzz.com

URL to article: http://techie-buzz.com/how-to/hiding-paid-links-from-google-bot.html

URLs in this post:

[1] suggested a simple trick: http://techie-buzz.com/annoyances/dont-want-a-pr-hit-follow-this-fool-proof-trick.html

[2] Google Paid Links: http://technorati.com/tags/Google%20Paid%20Links

[3] Hide Paid Links from Googlebot: http://technorati.com/tags/Hide%20Paid%20Links%20from%20Googlebot

[4] Googlebot: http://technorati.com/tags/Googlebot

Copyright © 2006-20011 Techie Buzz. All rights reserved.