Internet, Programming, & Power Engineering

Hiding Your Adsense Ad Block on Specified IP Addresses

The code below is a simple PHP script that hides, disable, disallow, or block the display of your own Adsense ad block on some IP addresses that you specified.

Example of IP addresses that you don’t want to display your ad block is your home network IP address. This will reduce the risk of gaining invalid clicks from other internet users who use the same IP address as yours. Of course, it is required that IP address should be static. You can determine your IP address at http://determinemyipaddress.jcmiras.net/.

A Simple Cloaking Technique

Since Cloaking is defined as “showing one page to search engines, and a different page for users”, this script is, technically, considered as a means of cloaking. And as we all know, cloaking a website can receive a penalty from search engines, specially, Google. Although, the intention is good, a simple misinterpretation by search engines can cause a havoc in your website.

However, you might as well, take the risk since this is so simple and may not be detected by search engines. Here is the code;

$ips=array(’xxx.xx.xx.x’,'yyy.yy.yy.y’);
if (!in_array($_SERVER[’REMOTE_ADDR’],$ips))
{$adsense_file=”adsense.txt”;
$file = fopen($adsense_file, “r”);
$adsense = fread($file, filesize($adsense_file));
fclose($file);
}
else
{$adsense=”";}

“adsense.txt” should contain the adsense code. ‘xxx.xx.xx.x’ and ‘yyy.yy.yy.y’ are the IP addresses where you don’t what to display your adsense ad block. You must place the above code on the section of your webpage where you want your adsense ad block to display.



Filed in: Codes and Scripts, Internet Marketing

«Previous article in Codes and Scripts: Matrix TCL Lite: A Matrix Header File for Matrix Operations in C++
«Previous article in Internet Marketing: Reselling Google Adwords Advertising Program

»Next article in Codes and Scripts: How to Display Comments in a Seperate Page in BBlog Script
»Next article in Internet Marketing: How to Earn Money from the Internet?

Linkblog

Search This Site

 
Web www.jcmiras.net

Sponsored Links


Translations

English flagItalian flagKorean flagChinese (Simplified) flagPortuguese flag
German flagFrench flagSpanish flagJapanese flagArabic flag
Russian flagHindi flag   
By N2H