Filtering yourself from Google Analytics

With a combination of GeekTool and a little teensy bit o' Google Analytics knowhow, you can ensure that GA isn't including your visits to your own site as part of their reports. If you're a developer (or someone who frequently visits their own site) this can come in really handy to assist in accurate reporting!

I, like many, many people out there, use Google Analytics on my website. At first, I obtained it because it seemed like a good idea at the time. I never really was one for tracking my userdata and that kind of thing, but I was convinced (by a discussion I can no longer find reference to) that it would be a good idea to start doing it, because in the future it might come in handy. So, I chose the easy thing: Google Analytics.

I’ve been tracking the stuff on my site for a long time – I can’t honestly tell you how long without actually going to see – but it’s been more than a year. I find all the various reports interesting, and it’s pretty cool to know that I get (on average) about 2-300 visitors per day. however, I am always confuzzled by the vast amounts of data that’s being reported, and just relegate myself to looking at the pretty lines going up and down every now and again, without a clue as to what it means.

As part of this sabbatical, I’ll be delving a little more deeply into this, and make an attempt to learn about this tool I’m using, and I’m going to start with this little tidbit: filtering myself out of my user data.

If you’re anything like me, you go through your own website every now and again – especially when you’re redesigning the layout – to check for broken links and other assorted weirdness. However, you’ll also notice that on the days when you do visit your own site to do site checks, or to respond to comments, or whatever, your data for that day might skyrocket. (I remember one day, when I first started, I was checking like crazy and had 120 more visits than usual – to discover later that it was all me.) As much as I might care about myself, I don’t care that much. ;) I want some semblance of accurate reporting, so I’ve been wanting to know how to filter myself out of the GA reporting.

This I went on a search to find out about how to filter myself. Lo and behold, there’s a whole section on filters from Google themselves. (Whodathunkit?) Turns out it’s a pretty simple process, and I’ll outline how I did it:


GeekTool is awesome. I’m so glad I found it – I can’t extoll it’s virtues enough. I don’t know if I use it in a typical manner, but I don’t have the space here to tell you how I do at the moment. However, unfortunately for you PC users, it’s a Mac-only thing. You’ll have to find an alternate method for obtaining your IP address than the one I describe here.

1. Find your IP address.
Now, granted, sometimes IP addresses are defined dynamically from your ISP, so if you define a single IP for yourself, someday that might change. You can do a range of IP’s, but if you do that, then you’ll possibly be blocking legit users to the site that aren’t you. Personally, I have a Mac that runs GeekTool, and my desktop is quote customized (hmm… a future post, I believe?) so I have a snippet of code that pulls in the IP address Comast has assigned to me, so I’ll use that (and I have something that’s always updated so I’ll know if it changes).

If you just so happen to be using GeekTool as well, here’s the code snippet, just in case you’re interested:

curl -s www.whatismyip.com/automation/n09230945.asp | awk {'print "Comcast IP | " $1'}

Of course, that little part that says “Comcast IP | ” you can change, it’s just the printed header I have to tell me what it is I’m looking at.

You should note that you also really should check your settings in that piece of code. If you use it outright, you’ll end up querying the “whatismyip.com” site once every 10 seconds, which is the default for GeekTool. After a week of the scriptlet running, I found myself banned. Whoops! So in the little box to the top right of where you put the code, be sure to change that “10″ to “86400″ – check it once a day, not every 10 seconds. If you’ve made the mistale, though, there’s a different site you can use, so replace the above with the following:

curl -s http://checkip.dyndns.org/ | grep -o "[[:digit:].]\+"

And be sure not to forget to change the amount of times you hit the server!

2. Get into the “Filters” Area so you can create one.
GA is cool, but sometimes it’s confusing to find what you need. Quickest thing is to click the little link in the top left-hand side of the orange bar at the top of the screen that says “Analytics Settings.” You’ll see a list of all your sites. Find the one you want to create the filter for, and look to the right – where you’ll see an “Edit” link. Lots of info, lots of info, lots of info… and somewhere in that “lots of info” you’ll see the “Filters” Section (“Filters Applied to Profile” in the dark gray header). In the far right, click the “Add Filter” link, and you’re on your way.

3. Create the predefined filter.
We’re adding a new filter, and that’s the button checked by default, but make sure that’s the one checked. Give your filter a name (I’ve titled mine “Exclude Me!”) and I’m using a predefined filter. Choose “exclude”, then “traffic from IP addresses”, and enter in your IP address into the boxes that appear. Make sure “that are equal to” is checked, Save your changes and BAM. You are now excluded from being reported in your GA data.

Nice and easy. Yum!

Now, keep in mind you’ll have to change your IP address every now and again, so be sure you glance at your GeekTool report every so often to see if it’s changed. It doesn’t happen often though, and it sure does keep your reports nice and valid!

Have your say:

* Copy this password:

* Type or paste password here:

1,988 Spam Comments Blocked so far by Spam Free Wordpress