A while back I wrote a post called Count Me Out! that explained how to exclude Google Analytics data based on the custom segment value.
My previous post was based on the old,
urchin.js tracking code, and a lot of people have been waiting for an update. It’s taken a while, but here it is.
I will mention that my favorite way to exclude traffic from Google Analytics is using an IP exclude filter. An IP based exclude filter is very accurate unless you having a changing IP. The method below works best if you have a dynamic or changing IP address.
Even if you’re not interested in this post, there is a fun ‘group activity’ below. Please try it!
The old version of this
hack method required you to add a new page to your website. That page would set the GA custom segment cookie (named
__utmv) on your computer.
This technique works fine, but who wants to add a new page to their site? It can be a pain.
Step 1: Set Custom Segment Cookie
Go to the site that you are tracking with Google Analytics and view a page.
Copy the code below and paste it into the location bar of your browser and click ‘enter’ on your keyboard.
You should see a message that says, “Custom segment has been set. Time to create a filter.”
Here’s a tip, you can bookmark this JS to make it easy to reset the cookie in the future. I set the cookie every time I fire up my browser.
Step 2: Create Exclude Filter
Next, create an exclude filter in Google Analytics to exclude the user defined segment (i.e. the cookie) you just created:
This filter will exclude anyone with a custom segment cookie with a value of ‘remove-me’.
Remember, cookies are specific to a browser and computer. If you use mulitple browsers or multiple computers you need to set the cookie using all the browsers on all the computers you use.
Having Some Fun With This!
You’ve probbaly figured out that you can set the custom segment cookie on anyone’s website as long as they’re using GA. This means that you can add data to their User Defined report. Let’s try this on my site!
Navigate to www.cutroni.com/blog and place the following code in the location bar of your browser after the page has loaded. Change FOO to whatever you want and press enter on your keyword. That’s it. You’re now in my data.
I’ll post some of the more popular and creative values in Twitter and maybe here at a later date.
Please try to keep it clean. I often review data with my 4 year old son :)
Thoughts on the Old Method
The old version of this technique uses a form to set the custom segment cookie which is pretty handy if you have a lot of people in remote locations that need to be excluded from the data. Just send all your coworkers, contractors, etc. a link to the page and ask them to set the cookie on their computer. It’s a little easier than asking them to paste JS into their browser.
If you’re interested in using this technique here is a new version of the page and the process.
Step 1: Create a new page on your site using the code below.
** Note ** The information below is in an iFrame. If you receive this post via email you may not see the contents.
Step 2: Go to the new page you just added, fill out the form, and click the ‘Create Cookie’ button. Keep track of the value you enter into the form, you need it for step 3.
Step 3: Finally, create an exclude filter in Google Analytics to exclude the value that you entered into the form. Remember, you need to use a regular expression for the filter field. So if you entered ‘remove-me’ in the form, enter ‘remove-me’ as the Filter Field.
That’s it. Sorry for the lame post, but I’m trying to update a lot of the old code and posts on the site.
Like this post? Share it: