Google Website Optimizer IP Filter

Written by:
Last updated: May 1, 2025

Recently we have been using Google’s fabulous  website optimizer to improve conversions on a site we are running. The system uses A/B testing and is very easy to set up and use. It does have one major problem however, and that is you cannot exclude the IP address of certain visitors. I discovered this when I started to notice my own results showing up in tests, thereby invalidating the results. you would think that such an otherwise comprehensive system would not have this oversight, but apparently it does.

The Solution

There is however a solution to this problem, albeit one that requires a bit of code know-how, and a system capable of running PHP or another programming language. Simply add the following code to your pages:

[source:php]

<?php

//exclude certain IP address

if ($_SERVER[\’REMOTE_ADDR\’]!= “YOUR IP ADDRESS HERE”){

?>

[/source]

Google code goes here.

Then simply add:

[source:php]
<?php } ?>
[/source]

Do this for every page that has the tracking code. There, problem sorted, and all results from that IP address will now be ignored as they will not be reported to Google. You could of course use a whole list of IP address to exclude should you need to.