How to Exclude Internal Traffic from Google Analytics when Internal IP Address is Dynamic

Google Analytics has a build in filter that allows you to traffic from an IP address. It works fine when you have a static IP but when the IP is dynamic is does not work (If you are not familiar with how IP filtering works then I will write about it later). In this post I will explain how to exclude internal traffic using a method other than IP address

Use Custom Filter

Custom filter allows to exclude traffic by Cookie Content set via setVar.

To exclude traffic from dynamic IP addresses, you can use a JavaScript function to set a cookie on all internal computers and browsers. You’ll then need to create a filter to exclude any traffic that has that cookie set.

How to exclude traffic by cookie:

  1. Create a new page on your site that sets the Custom Variable (User Defined) value in a cookie. The way you do is as follows<body onLoad=”javascript: gaq.push([‘_setVar’, ‘Exclude’]);”> – Note this code is in addition to your Google Analytics tracking code on your page
  2.  Let’s call this page do-not-track-me.html
  3.  Visit http://www.yourdomian.com/do-not-track-me.html page from all computers and browsers that you would like to exclude the traffic from i.e. all your internal computers and browsers. (Once set, you can check this value by looking at _utmv cookie on your computer)
  4. Create an Exclude filter to remove data from visitors with this customer variable value:

Filter Type: Custom filter > Exclude
Filter Field: User Defined
Filter Pattern: Exclude
Case Sensitive: No

Note: If at any point you override the cookie or delete the cookie, your traffic will no longer be excluded.

Comments

  1. OK, That;s all good, but how do you then do the same but to INCLUDE ONLY the internal visits ?

    I tried using the same Filter but with ‘Include’ and it just doesn’t seem to work…

    Any ideas ?

    Regards

    John

  2. I believe that you have to add an underscore before the gaq.push, so it should be:

  3. Thanks… ditto what Emanuel said… it should be _gaq.push not gaq.push

Trackbacks

  1. […] How to Exclude Internal Traffic from Google Analytics when Internal IP Address is Dynamic […]

Speak Your Mind

*