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

18 replies
  • SEO
  • |
I recently created this post on my new blog, and thought i would share it here.
If you want to share the post on your own blog or whatever the link is here - How To Stop Google Analytics From Tracking Your Own Visits To Your Website (i'd much appreciate the organic link building as part of my case study)



Step 1

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



Step 2

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


Step 3

You will see the following text just above your default url: Web Property ID: UA-xxxxxxx-x . Copy this code (Just the UA-xxxxxxx-x).
Keep this tab open as we will need it later.



Step 4

Open notepad.



Step 5

Then paste the following code into notepad and replace UA-xxxxxxx-xx with your own UA code.
Code:
<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’);”>




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.






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.






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 Filters > + New Filter






Step 9

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






Step 10

Navigate to the page that you uploaded. For example mine would be something like this -
http://www.internetmarketinghustle.c...-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.


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

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.
#analytics #google #stop #tracking #visits #website
  • Profile picture of the author lukedidit
    Fanatasic job, I was also meaning to get round to finding out about this.
    {{ DiscussionBoard.errors[5338975].message }}
  • Profile picture of the author lukedidit
    Just to add to this - I have multiple sites under my GA account, so you can repeat the process but change the pageTracker var each time:

    Code:
    <body onLoad=”javascript:pageTracker._setVar(‘site_one’);”>
    Code:
    <body onLoad=”javascript:pageTracker._setVar(‘site_two’);”>
    And then change the filter pattern each time for the new pageTracker.

    The only short fall about this is I tend to hit my pages with incognito mode or private mode a lot, so I will still be tracked. To get around this I will bookmark the script pages and just call them up each time.
    {{ DiscussionBoard.errors[5338986].message }}
    • Originally Posted by lukedidit View Post

      Just to add to this - I have multiple sites under my GA account, so you can repeat the process but change the pageTracker var each time:

      Code:
      <body onLoad="javascript:pageTracker._setVar('site_one');">
      Code:
      <body onLoad="javascript:pageTracker._setVar('site_two');">
      And then change the filter pattern each time for the new pageTracker.

      The only short fall about this is I tend to hit my pages with incognito mode or private mode a lot, so I will still be tracked. To get around this I will bookmark the script pages and just call them up each time.
      thats a great idea
      {{ DiscussionBoard.errors[5343803].message }}
  • Profile picture of the author discustipated
    Thanks. Ill bookmark this and share to my social accounts. I have been meaning to do this for awhile now.
    {{ DiscussionBoard.errors[5338997].message }}
  • Profile picture of the author Henlus
    Again, thanks very much for this tutorial. I'll try it out and if it works I'll post it on my site.
    {{ DiscussionBoard.errors[5345311].message }}
  • Profile picture of the author Joseph Denali
    The "old" version of GA allowed you to filter by IP address. I haven't tried this filter with the updated version, so I may give this a shot. Thanks for sharing!
    {{ DiscussionBoard.errors[5345401].message }}
  • Profile picture of the author StoneWilson
    Nice work. But I don't think Google Analytics data is that acurate, so I won't mind if it counting my visiting data. lol~
    Signature
    Looking for godaddy renewal coupon? Check GodaddyRenewal.com!
    {{ DiscussionBoard.errors[5347919].message }}
    • Originally Posted by tristatemedia View Post

      wow, that is wild but risky in my opinion.
      what exactly is risky?

      Originally Posted by StoneWilson View Post

      Nice work. But I don't think Google Analytics data is that acurate, so I won't mind if it counting my visiting data. lol~
      If you dont have a lot of traffic already then you own stats can make the overall site statistics very misleading

      if you are getting 1000's of visit per day a few from yourself isnt really going to make that much difference.

      But for new sites this is a must!
      {{ DiscussionBoard.errors[5351879].message }}
  • Profile picture of the author Maraun
    There are also some free Wordpress plugins that don't report visits from certain users to GA at all, so there is no need to filter in GA itself later.
    {{ DiscussionBoard.errors[5352306].message }}
    • Profile picture of the author oracrazy
      Hello,
      It did not work in my case, can you please tell me why. One doubt are you using single quotes (') or back quotes (`) around script or test_value ? it worked in neither of the cases at my place. Can the author please verify the code again and check if it is correct? Thanks
      {{ DiscussionBoard.errors[6433135].message }}
  • Profile picture of the author directorylist10
    I don't think so
    {{ DiscussionBoard.errors[6435530].message }}
    • Profile picture of the author oracrazy
      Originally Posted by directorylist10 View Post

      I don't think so
      What do you mean by that. It does not solve my problem. I want to know the solution / reason for it not working in my case, if it has worked everywhere else.
      {{ DiscussionBoard.errors[6438604].message }}
  • Profile picture of the author elzafonv
    thanks. if you r using wordpress and don't mind extra plugin for that, most of the plugins i know will have a checkbox to exclude your visits.
    Signature

    and in the end the love you take is equal to the love you make.

    {{ DiscussionBoard.errors[6438925].message }}
  • Profile picture of the author Jdunhin
    Nice job. Going to use it!
    Signature

    We handle all your WordPress Content,Theme and Plugins updates!
    iAdminWP

    {{ DiscussionBoard.errors[6439116].message }}
  • Profile picture of the author Dicksonkho
    Thanks for the sharing, i will try it.
    {{ DiscussionBoard.errors[7467742].message }}
  • Profile picture of the author shanmuharajan
    I followed this procedure. Please Let me know the procedure for dynamic websites.
    {{ DiscussionBoard.errors[8467953].message }}

Trending Topics