How To Stop Google Analytics From Tracking Your Own Visits To Your Website

How To Stop Google Analytics From Tracking Your Own Visits To Your Website

December 30, 2011 Blog, Google Analytics, Tips 1

I don’t know about you but I’m constantly hitting that preview button when writing these posts and I’m always constantly checking my pages, clicking on every link to make sure everything works. The thing that I’ve noticed about doing this is that it REALLY messes up my Google analytics stats.

I get an insane amount of page views counted because I’m constantly hitting the preview button, and my average time on site is up to about 30 mins at the moment, which is ridiculous. For a new site starting out it makes these statistics USELESS. In order to get precise statistics you need to block Google analytics from recording any of your own activity on your sites. To do this we will add a page to our website with a specific analytics code and then create a custom filter to make sure we do not get tracked while browsing our sites.

I found this method through a Google Forum user called ‘Whim’s’. She is literally the oracle of all things Google!

 

Step 1

First log in and open your Google analytics account (http://www.google.com/analytics) and navigate to your site.

Sign in to Analytics

Step 2

On the right hand side you will see a cog symbol, click on this to open the settings.

Click on the cog symbol

Step 3

You will see the following text just above your default url: [highlight bgcolor=”” textcolor=””]Web Property ID: UA-xxxxxxx-x [/highlight].  Copy this code (Just the UA-xxxxxxx-x).

Keep this tab open as we will need it later.

Copy + Paste UA Code

Step 4

Open notepad.

Click Start > All Programs > Accessories

Step 5

Then paste the following code into notepad and [highlight bgcolor=”” textcolor=””]replace UA-xxxxxxx-xx with your own UA code[/highlight].

[alert]

<script type=”text/javascript”>

var _gaq = _gaq || [];
_gaq.push([‘_setAccount’, ‘ UA-xxxxxxx-x’]);
_gaq.push([‘_trackPageview’]);

(function() {
var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
})();

</script>
<body onLoad=”javascript:pageTracker._setVar(‘test_value’);”>

[/alert]

Remember to replace UA-xxxxx-xx with your own UA number.

Step 6

Now click File > Save As

Name the file something obscure and something a user is unlikely to type into their web browser when on your site, I just hit the keyboard randomly to do this.  Add ‘.html’ to the end and click save.

Name the file something random.

Step 7

Now upload this file into the home/public_html directory via ftp.  You will know when you are in the correct directory as you will see your standard wordpress folders: wp-admin, wp-content, wp-includes.

Upload via ftp.

Step 8

Now we need to create a custom filter in Google Analytics.  Go back to the tab where you got your UA-xxxxxxx-x code from and click on [highlight bgcolor=”” textcolor=””]Filters > + New Filter[/highlight]

Add a new filter.

Step 9

Now enter the same information you see in the screenshot below and click Save.

Make sure you double check you have copied it correctly.

Step 10

Navigate to the page that you uploaded. For example mine would be something like this –

http://www.outsprung.com/whatever-I-named-the-file.html

You should just see a blank white page.

That’s it you are done, you have successfully excluded your activity from Google Analytics.

[alert] Remember: You will have to visit this page each time you clear your cookies in your browser, so be sure to bookmark the page for future reference [/alert]

Step 11

Just to double check you have done it right, visit the page a few times, refresh the page 5-10 times. Give it 1-2 hours (it can take up to 24 hours for stats to appear, please bear this in mind) and check that your activity has not been tracked by having a look in the ‘Content’ section of Google Analytics.

 

 

About the author

Paul Manwaring: This is where we share a thoughts, tips and research into the world of marketing, design and business. Be sure to follow us on Twitter and Facebook.

1 Comment

  1. Rhomeo Hildawa

    February 9, 2012
    Reply

    Thanks! this is just what I need! very helpful!

Would you like to share your thoughts?

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

Leave a Reply