Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a development environment for a website. The environment is an exact clone of the production side, so it's going to have google analytics on it. What's a good way to exclude traffic?

I tried google analytics filters but I think i'm missing something.

Here's what I tried:

Filters > Predefined
 - Exclude | traffic from the domains | that are equal to, that contain
 - sub.mydomain.com

Filters > Custom
 - Exclude | Hostname
 - Filter Pattern: ^sub\.mydomain\.com

Anyone have any suggestions?

share|improve this question
If you have a condition that looks up the host name, you could have the same code on both production and dev, but on dev you wouldnt display GA code. (PHP: if ($_SERVER['HTTP_HOST'] != 'dev.mysite.com') printGACode();) – milo5b Aug 15 '12 at 18:25
up vote 1 down vote accepted

Assuming only a handful of people are going to see the development site you could exclude the IP addresses of those that will visit it. You may still have someone test something on an IP not included but that should get rid of most of the unwanted data, as well as help keep your data from being skewed by you on the live site.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.