Bad Behavior was blocking Google Analytics Verify

This morning I was setting up a new blog to use Google Analytics. I’ve done this many times before. However, this morning every time that Google would try and verify the site, the verification would fail.

I ran a view “page source” on my site’s home page with both Internet Explorer and Firefox and I could see the correct Analytics code. I looked in my web server logs and could see that Google had accessed the site. After checking a few more things, I recalled that last week “Bad Behavior” had been blocking Windows Live. See: Bad Behavior Workaround – Dealing with Windows Live..

I checked my “Bad Behavior” log and saw that “Bad Behavior” was reporting that it had blocked 74.125.75.17.  The reason given was “IP address found on http:BL blacklist”.  I determined that this IP address did belong to Google. I ran several more tests and each time the Google Analytics verifier used this IP address and was blocked.

I added the IP Address to my “Bad Behavior” white-list located in directory <blog>/wp-content/plugin/bad-behavior/bad-behavior/whitelist.inc.php and restarted my httpd service. This allowed me to verify Google Analytics.

I use several of Google’s service. This has me considering white-listing all of Google’s IP Addresses. Currently, this appears to be “74.125.0.0/16″ in CIDR format. However, at this time I decided not to do this. One of the main reasons is that would make me trust any computer that accesses the internet from inside of Google. I’m not sure that I’m ready to do this.

Below is my whitelist.inc.php code with the IP 74.125.75.17 white-listed.

<?php if (!defined('BB2_CORE')) die('I said no cheating!');
 
function bb2_whitelist($package)
{
	// DANGER! DANGER! DANGER! DANGER! DANGER! DANGER! DANGER! DANGER!
 
	// Inappropriate whitelisting WILL expose you to spam, or cause Bad
	// Behavior to stop functioning entirely!  DO NOT WHITELIST unless you
	// are 100% CERTAIN that you should.
 
	// IP address ranges use the CIDR format.
 
	// Includes four examples of whitelisting by IP address and netblock.
	$bb2_whitelist_ip_ranges = array(
		"64.191.203.34",	// Digg whitelisted as of 2.0.12
		"208.67.217.130",	// Digg whitelisted as of 2.0.12
		"10.0.0.0/8",
		"172.16.0.0/12",
		"192.168.0.0/16",
                "74.125.75.17",          // Google
                "65.54.233.0/24",       // Microsoft Live
//		"127.0.0.1",
	);
 
	// DANGER! DANGER! DANGER! DANGER! DANGER! DANGER! DANGER! DANGER!
 
	// Inappropriate whitelisting WILL expose you to spam, or cause Bad
	// Behavior to stop functioning entirely!  DO NOT WHITELIST unless you
	// are 100% CERTAIN that you should.
 
	// You should not whitelist search engines by user agent. Use the IP
	// netblock for the search engine instead. See http://whois.arin.net/
	// to locate the netblocks for an IP.
 
	// User agents are matched by exact match only.
 
	// Includes one example of whitelisting by user agent.
	// All are commented out.
	$bb2_whitelist_user_agents = array(
	//	"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) It's me, let me in",
	);
 
	// DANGER! DANGER! DANGER! DANGER! DANGER! DANGER! DANGER! DANGER!
 
	// Do not edit below this line
 
	if (!empty($bb2_whitelist_ip_ranges)) {
		foreach ($bb2_whitelist_ip_ranges as $range) {
			if (match_cidr($package['ip'], $range)) return true;
		}
	}
	if (!empty($bb2_whitelist_user_agents)) {
		foreach ($bb2_whitelist_user_agents as $user_agent) {
			if (!strcmp($package['headers_mixed']['User-Agent'], $user_agent)) return true;
		}
	}
	return false;
}
 
?>
Be Sociable, Share!
This entry was posted in google, wordpress and tagged , , . Bookmark the permalink.