Blog

Some of my thought on technology and programming.

Surprisingly, the solution is pretty simple, in your admin area you need to set a cookie. This cookie can have any name and any value but must be consistent for every user.

My preferred method setting this cookie is to use Klaus Hartl‘s jQuery Cookie plugin, you could also choose to use server side scripting (PHP, ASP, JSP etc) or just raw JavaScript.

1
2
3
4
<script src="/path/to/jquery.cookie.js"></script>
<script>
    $.cookie('tracking_exclude', 'tracking_exclude', { expires: 3650 });  // analytics exclusion (expires in roughly 10 years)
</script>

Once this is added to your admin page, every time a user visits the admin section they will have the cookie updated.

Google Analytics

Brilliant, you now have a cookie but how does this help? Well, first you need to log into your analytics app (in this case Google Analytics) and add the exclusion.

  1. Open Google Analytics
  2. Click “Admin” (in the orange navigation bar)
  3. Click on the domain you wish to add the exclusion to (in the list lower down the page)
  4. Click on the domain again
  5. Click on the “Filters” tab
  6. Set everything up as shown below, then click “Save”:
    Analytics exclusion settings

Congratulations, you and anyone else that logs into your admin section will no longer appear in your analytics data.