Stop Google Analytics Tracking Your Own Visits

Laboratory Blog 2013-06-25

Over the past few months I’ve built a number of websites and have ended up working alongside Google Analytics pretty closely. Google Analytics is a great tool when used effectively but many folk don’t seem able to set it up correctly from the off. The main problem I see is that people don’t stop Google Analytics from tracking their own visits.

If you’re running a site which receives a lot of traffic then realistically your own daily visits aren’t likely to skew your analytical reports too much. What’s more likely when you’re first starting out however is your site receives relatively few visitors. This means that if you fail to stop Google Analytics reporting your own personal page views it will begin to produce some very odd, unusable data whilst you design, develop and create content. 

If you’re seeing reports of a crazy low bounce rate, audience demographics completely identical to your own and/or pages you know haven’t been indexed by Google yet are getting a silly number of page views then you should probably think about excluding yourself from your analytical data.

Google Analytics

Huge average visit durations and a low bounce rate on a brand new site… This looks suspiciously like ME!

There are a few different ways to stop Google Analytics from tracking your own visits and perhaps most common would be to set up a filter to exclude your own IP address. I tend to do things differently for sake of fact that I only ever work from one computer. It is much more convenient for me to solely exclude that device alone from involving itself in the data collection than worry about filtering out dynamic IP ranges. Here’s how:

  1. Head on over to the where you’ve set up Google Analytics (i.e. http://www.laboratoryblog.net)  
  2. Give your computer a name by entering the following Javascript into the URL bar replacing NAME with a unique identifier you want to give your computer:
    javascript:void(function(w){try{_gaq._getAsyncTracker()._setVar(w)}catch(e){try{__utmSetVar(w)}catch(e){pageTracker._setVar(w)}}alert(w)}('NAME'));void(0); 

    For security sometimes web browsers will strip javascript: out of the code when you paste it into the URL bar. Google Chrome is a culprit for this. You may need to enter it in manually.

    Stop Google Analytics Tracking Yourself with JavascriptOther browsers such as Mozilla Firefox might not allow you to perform this action from the URL bar at all. In this instance you will need to load up the Web Developer > Web Console from the Tools menu.

    PERFORM THIS SEQUENCE FROM WITHIN EACH BROWSER YOU USE. THEY TYPICALLY DO NOT SHARE THIS ASSIGNMENT BETWEEN THEM.

  3. If all has gone well then you should receive a popup message displaying the identifier you assigned.  

    Stopping Google Analytics with Javascript Displays a Popup

  4. Now log in to Google Analytics and navigate to the website account you just set up the identifier for and navigate to Filters.  Filter out your own computer from Google Analytics
  5. Assign a Filter Name which will serve as a descriptor for your future reference.

    Set the Filter Type as Custom Filter and choose to Exclude.

    In the Filter Field you want to select User Defined under the Other heading. With this enter the identifier you established earlier on into the the Filter Pattern form.

    Add the filter from Available Profiles of your choosing to Selected Profiles.

    Stop Google Analytics From Tracking Your Own Visits

And that’s it! Finito. You should now no longer have your own activities reported by Google Analytics. It’s not just a case of waiting for the next couple of days reports and establishing you’re no longer visible in them.

Now you’re reporting accurately you can begin to take real note of your analytical data to begin plotting your next move for global domination.

If something appears to have gone amiss then there’s an easy way to check that the identifier has been set up properly by heading back on over to your website and as before entering some similar javascript:

javascript:alert((/__utmv=.+?\.(.*?)(;|$)/.test(''+document.cookie))?RegExp.$1:'No unique word');void(0);

Your browser will either report back the name you assigned or state ‘No unique word’. In result of the latter be sure to follow the above steps through again carefully. Should you still be having problems thereafter then it’s likely that you made an error when setting up the filter from within Google Analytics itself.

It might also be worth noting that if you ever elect to clear or delete all your browser cookies you will need to reassign the identifier to your computer once more.

Did Google Analytics play games with you when starting building websites? Have you experienced any problems? Let me know!

The post Stop Google Analytics Tracking Your Own Visits appeared first on Laboratory Blog.