Don’t track traffic in Google Analytics from your computer

Posted on

I recently built a new website that wasn’t getting much traffic which I was using analytics to track the traffic for. I found that while testing the site I was skewing the data which I had not accounted for initially, so I couldn’t tell who was visiting the site at first. Well I did some digging and found that I could set up a filter to not track certain IP addresses. I didn’t think this was a good idea since I knew that verizon’s DSL IPs were pretty dynamic and will switch about once a month or so. With some more research I found that I could set a cookie with a specific value and set a filter up in Google Analytics so that if the browser had the specific cookie it wouldn’t track it. Here are the stops to set this up:

1) First create a page called no_track.html or something memorable with the following code. Make sure to change the (“UA-XXXXXX-X”) bit to your Analytics account number for your domain.

<html>
<head>
</head>

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write("</script><script src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'>< /script>" );
</script>
<script type="text/javascript">
var pageTracker = <em>gat.</em>getTracker("UA-XXXXXX-X");
pageTracker._initData();
pageTracker._trackPageview();
</script>

<body onLoad="javascript: pageTracker._setVar('no_track');">
<p> Welcome, your computer will not be tracked on this site as a cookie has been
set to exclude it.</p>

</body>
</html>
---------------------------------------------------------------

2) Create an Exclude filter to remove data from visitors with this cookie. Follow these instructions http://www.google.com/support/googleanalytics/bin/answer.py?answer=55494
to create a filter with the following settings:

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

3) In order to set the cookie, visit your newly created page from all computers that you would like to exclude from your reports. Please note that if you clear your cookies on your browser that you will have to visit this page again to re-set the cookie.


2 thoughts on “Don’t track traffic in Google Analytics from your computer

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>