The Simplest Filtering Method to Exclude Traffic from Your Internal Computers in Google Analytics, No IP Address Lookup!
Don't spend time trying to analyze your Google Analytics traffic until you've followed this simple guide to excluding your own traffic from the analytics results. When your web site has relatively few visitors, your influence as the author of the web site on the traffic statistics may make them nearly meaningless.
In about one minute you can follow these easy instructions to ensure that the traffic you see in Google Analytics is an accurate representation of the visitors that you care about. You will not need to download any software or browser plugins and you can follow the instructions in the web browser of your choice.
Google Analytics traffic filtering is applied for any new traffic coming in, so your existing statistics will not be changed. If you decide to start another web site, remember this advice as a first step to keep your traffic graphs clean from the start.
Update: Our easy commands below have been updated to support the recently released Asynchronous Analytics tracking. - Jan. 27, 2010
Part 1: Give your computer a name
The first step to excluding internal traffic from your web site traffic stats is to give Google Analytics something unique by which to identify you.
- Go to any page on your web site that uses Google Analytics tracking. If you use HubPages, you can follow these instructions without leaving this page!
- Copy the entire one-line code below and paste it into your web browser address bar, entirely replacing the current web address. You may need to retype javascript: at the beginning of the URL after pasting.
- Replace Unique Word near the end with any word of your choice, always use the same word to avoid having to make changes in Analytics.
- Once you have changed the code, press the Enter key.
- If your unique word appears in a popup box it has been successfully set.
- Repeat these steps on all of your sites that use Google Analytics, once per domain (i.e. only once for all of your content at hubpages.com, and once again for yourwebsite.com). If you use multiple web browsers, these steps may need to be repeated in each.
javascript:void(function(w){try{_gaq._getAsyncTracker()._setVar(w)}catch(e){try{__utmSetVar(w)}catch(e){pageTracker._setVar(w)}}alert(w)}('Unique Word'));void(0);
No popup?
Recent browser updates may disable the ability to run this code from the URL bar. Try these instructions instead.
Firefox: go to the Tools menu > Web Developer > Web Console. You will see a > with a blinking cursor beside it. Paste the code in the article then press the Enter key. To close the console, hit the x button at the top of the console panel.
Chrome: click the wrench icon then select Tools > Javascript Console. You will see a blue >, click in that area and paste the code above. To close the console, hit the x button at the top of the console panel.
This code tells Google to store a specific word on your computer that will identify you when you are browsing your web site. Don't worry, your unique word can't be seen by sites other than your own.
Troubleshooting
If you experience an issue with the code above or with your traffic filtering, please post a comment below and the author will be glad to help. Be sure to read other recent comments to see if your problem has already been reported and to try potential fixes.
As web browsers adapt to new security and usability standards, some of the technology required for this script may become outdated. If your issue is not solved in the comments or in the blue box to the right, please report it with as much helpful info as you can gather.
Part 2: Tell Google Analytics to filter out your traffic
The Google Analytics Filter Manager is a very powerful tool for filtering your content. The Filter Field dropdown which you will see soon lists all of the different traffic identifiers which you can use to customize your Analytics reports.
- Go to the Google Analytics Filter Manager (you can always find a link to this page at the bottom of your Analytics homepage)
- Click the + Add Filter link which is located at the right of the gray bar.
- Type a filter name, something like My Traffic or Author Filter.
- After Filter Type, select the Custom Filter option.
- In the Filter Field dropdown, select User Defined (near the top of the list).
- In the Filter Pattern text box, type the unique name that you used in Part 1.
- Finally, in the Available Website Profiles list, select your web site address (i.e. hubpages.com) and click Add » to move your site to the Selected Website Profiles list. Repeat this step for each web site that you track with Google Analytics.
- Click Save Changes at the bottom of the page.
This simple setup will allow you to exclude yourself from your Google Analytics statistics whenever you visit your web site from your home computer. If you ever switch computers, just follow the steps in Part 1 using the unique word that you've chosen to filter.
How to Check If Your Browser is Filtered Out
If you are not sure whether you set a unique word or do not remember what it is, try these simple steps:
- Go to any page on your web site that uses Google Analytics tracking.
- Copy the entire one-line code below and paste it into your web browser address bar.
- No changes are necessary, just hit Enter.
javascript:alert((/__utmv=.+?\.(.*?)(;|$)/.test(''+document.cookie))?RegExp.$1:'No unique word');void(0);
IE 9 Users
IE 9 will remove the javascript: portion of this link when you paste it into the address bar, you will have to type that portion manually.
Your current unique word will appear in a dialog window which you can then close. If you see a different word than you set up in Part 2, you should follow the directions in Part 1 to apply the correct unique word. If you still see the wrong code after following the directions in Part 1, clear your cookies and try again - a previously set unique word cookie may be overriding your new setting. Be sure to do this step in each web browser that you use since the unique word may or may not be shared between browsers.
Translations of this article
Thank you to those readers who have taken the time to translate these instructions, your work is appreciated!
- La forma más simple de eliminar tu propio tráfico en Google Analytics (Spanish)
- Comment exclure vos propres visites des stats de votre site ou blog en moins de 5 minutes (French)
If you have written or found a different translation, please post it in the comments.
Why is This the Easiest Way to Exclude Myself from Analytics?
Unless you have read other articles already and tried to exclude yourself from Google Analytics, you may not appreciate how much simpler this is.
- You can use the same unique word on any computer without ever returning to the Google Analytics Filter Manager.
- You do not need to modify any of the code on your existing page.
- You do not need to look up the IP address for your home network and all other places where you want to browse your web site.
- IP addresses, the codes that uniquely identify computers and home networks, change often and without warning; your unique word will not change.
- It works with both the old and new Google Analytics and Urchin tracking code.
Automatically identifying multiple authors
If you have multiple authors, you can make a simple addition to the HTML code of one of your author-only pages which will automatically add your unique code whenever they sign in. By making this change you can avoid contacting your entire writing staff with the instructions above while still ensuring that they are not tracked.
- Add the following snippet to your HTML code, it can appear anywhere on the page.
- Edit the UniqueWord to something meaningful, such as "authors"
<script type="text/javascript"> setTimeout(function (){var s=function(v){ try{_gaq._getAsyncTracker()._setVar(v)}catch(e){ try{__utmSetVar(v)}catch(e){ try{pageTracker._setVar(v)}catch(e){ setTimeout(function(){s(v)},500)}}} };s('UniqueWord')}, 500); </script>
NOTE: In order for this code to work, the Google Analytics code snippet must also be included somewhere on the same page, before or after the above code. Some admin systems such as WordPress may not include analytics tracking on administrative pages. While it may seem counterintuitive, you may need to paste your Google Analytics code snippet into the admin page as well in order to make the above code work.
Ignoring all visits to your hidden page
Your first visit to this author-only page will still be logged in Analytics. In order to prevent that, you can create a second filter in Analytics following the instructions above but instead filtering on the field "Request URI." For this filter, if your hidden page is at www.mysite.com/path/to/hiddenpage.html you would type "path/to/hiddenpage.html" as the filter pattern. That should prevent all of your visits to the hidden page for the purpose of installing the code on a new computer from being tracked.
Reader Feedback
Are these instructions easy enough?
Multiple user class segmentation, alternative to exclusion
If you have multiple authors, you may want to track their activity as well, just segmented out from normal users. This is also very simple to do. The instructions below will create a new Website Profile for your staff which you can access from the Google Analytics homepage.
- Go to the Google Analytics Create a New Website Profile page (you can always find a link to this page at the bottom of your Analytics homepage)
- Select Add a profile for an existing domain.
- Choose your web site from the dropdown list and name the profile something distinguishing, such as Blog Co-authors.
- Follow the instructions in Part 2, but change the selection below Filter Type from Exclude to Include. This will exclude any traffic that doesn't match your unique word.
Google is a trademark of Google, Inc.
Google Analytics logo is from gaforflash, distributed under Apache License 2.0
Dream/Reality graphic designed by stock.xchng contributor iamwahid
Screenshots taken in Ubuntu 9.04 using Radial theme.
Reader Comments
Hi,
I thought of another approach using HTML5's localStorage feature. The advantage over the cookie is that when you clean your browser's cookies, localStorage values remain.
I've written a blog article about it here:
my google analytics are showing any data. my webmaster tools sub domain is not verify with in google analytics.say as Verification failed for https://hubpages.com/@robin using the Google Analytics method (less than a minute ago). The tracking code used by your site is not associated with your Analytics account. please guide me as i am confused very much.please if possible sent me a email so that i can correct the error. my hub sites 2 hubs http://ravinderkumarshar. thanks
Thank you for your great tutorial. Unfortunately, it doesn't work for me, the message is as follows:
uncaught exception: ReferenceError: pageTracker is not defined
Also tried changing to trackPageview with no success... Help!
Tried with http://www.aestivum.com
Great analysis, thank you for sharing! Now if I could only get rid of semalt!
After some additional digging, I found that the goofy URL addon appears, only when I use Chrome, which was the browser I used to install the javascript code. Firefox seems to work fine.
Doesn't look like this worked for me. After I made this change I noticed that there is addition of some code to the end of the URLs on my page, so when I share my links they don't look great. The link looks like this:
http://detourswelcome.com/camping-france-maps-chai...
When it should look like:
http://detourswelcome.com/camping-france-maps-chai...
Removal:
I attempted to remove this by deleting my cookies, but the addition to the URL keeps popping up. Any ideas on how I can remove this javascript from my site and stop the addon code to my URLs?
Thanks!
HEy! I tried to do the first step, but my unique word box wouldn't appear, so I tried to do the blue box suggestion and I don't think that has worked either, when i paste the code in the javaconsole and hit enter it gives an answer in red saying: "Uncaught ReferenceError: pageTracker is not defined" :( what doI do? BLogger stats keep counting my own views and I have tried EVERYTHING, now this... :(
Extremely well designed Hub, I planned to set this up this week sometime so I'll have to test this out then.
Wow! Thanks...easy to do.
Also, for those having trouble finding the filters, click on "admin", and then "all filters". And the "User Defined: in the filter field is way down the list, under "Other".
Everything seems to work fine. Used Web Console in Firefox, and in the Apply Filter to Website Profiles all there was "All Web Site Data" so I used this and it seems to be OK.
Has anyone been able to get this to work? I am still stuck at the Apply Filter to Website Profiles as it doesn't give me the option. Can anyone tell me what I am doing wrong? I am using IE 9 as my browser...
Thanks. Finally a really good solution. Piwik uses this kind of cookie and I was really wondering why Google wasn't offering it right away.
To avoid the "pageTracker is not defined" error message, change the code to say "trackPageview" instead of "pageTracker"
Hi Diannetrussell,
I got stuck at the same stage as you, all was good until choosing the profiles which I couldn't do. I visited my profile page and it definitely didn't work. Did you get it working in the end?
Using Firefox. Tried using the Web Console for Step 1.
Got "ReferenceError: pageTracker is not defined" msg. Can you help?
Absolutely the best article I have read on this subject. thank you.
Hi, all good until "available profiles list". None of my websites are on the list, even though they are all on my google analytics account and I can even see them there on the menu bar at the top of the page! There does not seem to be any way from this page of actually adding profiles to the list....
help!
hi,
thank you a lot for the instructions. They are by far the simplest and most elegant solution to the problem!
I was able to install the code word perfectly, but I am having a heck of a time with part 2 and trying to find the filter manager within Google Analytics. Have they changed the settings?
This article saved me so much time - It's a simple and elegant way to exclude my cputer from Analytics without me having to constantly update my IP address - Quality content, thanks and upvoted.
Hi... this is a great contribution. It works great and it is easier than the bodyOnload kind of solutions. ThankS!
Hi, am trying to do this in my web browser rocketmelt and am doing it like this :
www.freebiesnetwork.bizjavascript:void(function(w){try{_gaq._getAsyncTracker()._setVar(w)}catch(e){try{__utmSetVar(w)}catch(e){pageTracker._setVar(w)}}alert(w)}('userdebbiefn'));void(0);
this is what am typing on the add bar, is this wrong? please help.
Thanks!
I had it working a few days ago, now the code gives an error while trying to set up others to exclude...odd...
Very useful information, great to get a realistic set of data without the distorting influence of out own activity.
Sharing on twitter.
Hi fritteritter,
Using your code since a long time, but with Firefox 16 (for Mac) it doesn't seem to work anymore. No clue why. Not getting a pop-up window. Works like a charm on Safari and Opera.
Another novice here. Tried the method and got no pop up. You mention fixes for Firefox and Chrome but not Explorer, if you don't get a pop up. I have Explorer.
Thanks
Jack
Thanks--I'm willing to try anything!
I made a custom filter and put my unique word where it asked for "filter pattern." Do I need to reselect it frequently if I always stay logged in to GA? i'm not sure what you mean by this.
Thanks for the help!
Hello, thanks for the concise explanations, but unfortunately I do not have the option to apply the filter to website profiles. I can't access the former analytics interface, either.
Any suggestions?
Hi,
I've tried this in Firefox, IE and Chrome and nothing happens, apart from Chrome which just does a Google search for the code.
I had implemented this years ago and it worked before, it just doesn't seem to be working now in any browser.
Any ideas?
This one really works. Thanks!
Whoops, sorry. Just realized another Hubber answered my question with a link to your Hub. But that's still good. :~)
Thank you for answering my HP question with a link to this page. Much appreciated and very helpful so far. I managed to do the first step easily.
The second part is giving me a problem. I'm not able to access the Filter Manager. Your link doesn't work, and even typing it into my address bar doesn't work. It just keeps defaulting to the home page of my Google Analytics account. Any suggestions?
Great tips and very detailed making no assumption on level of knowledge. I'm off to try it now.
Thankss
Oops, please ignore the above two posts, I think it was actually working OK but I couldn't find the cookie file (was in a subfolder). Now working fine in IE9, Chrome, Firefox and Safari - and I even found out how to set up an extra Google Analytics profile which ONLY displays my visits (rather than excluding them) so I can 100% verify the settings are working. Thanks for the help and tips.
That page I referred to in my last post, www.portorleans.org/exclude-tracking.php, works fine on the same machine using Firefox by the way, and a Firefox cookie is created.
Ideally I'd like to use the inline javascript code version, and just use a bit of PHP to only run it when I visit the site's homepage while logged in as the Admin user (me), then I can just leave it there and forget about it for when I happen to use different machines.
Hmm, I can't seem to get this working on IE9 on either of my Win7 PCs. Works on Win7/IE8 at work though. I tried both the body code and the inline javascript version, but neither actually generate a cookie (I've searched through the file contents in the Windows cookies folder for the wording I was adding). The exclude-cookie code is embedded within a standard page layout on my site, so not sure if something in there is messing with it? Anyway, it's located at www.portorleans.org/exclude-tracking.php if anyone could maybe have a quick look at it for me to see why it does not actually create the new cookie? Oh, I also tried the method of putting the javascript line into the address bar, and while it popped up the correct alert box saying it had worked, still no cookie. Thanks!
I do not see the Apply Filter to Websites fields in Google Analytics. Will your solution still work?
Hi. I tried both metods: pasting the code and inserting the script in a separate page (http://danielpinero.com/exclude.html). Then created the filter in Google Analytics.
The popup appears to me with the name "test", but visits keep showing up in Google Analytics.
What could be the problem? Thanks in advance.
Tying that javascript in the address bar may no longer be sufficient, instead your browsers will provide an alternative place to put in the code, for example in firefox it's firefox, tools, web developer, scratchpad
paste it there
Excellent! Thank you. Much easier than other methods I read about in Google guides. Great hub.
Hi there! Does this tutorial still work with Google Chrome?! Looks really good. Just don't want to run through it all and it not work!
Thanks
Very clear and concise - even included pics for us visual learners. Much appreciated!
Yes, I noticed that before and fix it now, but filter code still not working.
Hi,
thank you for answer, but I did deleted cookies and it's still not working, I have a filter at home and work, and it is only working on Firefox (work and home) and Opera at home, other than that, it's not working.
In Chrome I have this message: ReferenceError: pageTracker is not defined.
Hi,
I only managed to filter my traffic on Firefox 10.0.2, I can't do it on IE9, Opera, Chrome (javascript console) and Safari and all of them are new versions of browsers on Windows 7 Professional OS, although it was working before on every single browser.
Do you have any sugestions or did you have problem like this.
Thank you
Hi there. I got to the end, but couldn't find the Available Website Profiles list in the latest version of Firefox.
Hmm thanks fritterritter, think I found the bugger.
In Google Analytics' script the account no. somehow dropped a 0 at the end, so the script I copy/paste first ended with 1-10, but now I saw it's listed as 1-1...
No clue how that could have happened.
Thanks FR - well still no reporting... The Exclude filter looks fine and the Unique Word script was installed when visiting main page...
Don't quite get this, what you mean with "public page"? Isn't every published page public?
Or does it have to be installed on a private page?
Hi, can it be that when the script with a Unique Word is used together with the Google Exclude filter that Google Analytics reporting doesn't work anymore?
That's what I did - and since well over 48 hours nothing is reported. Just zeros.
If so, how to undo the Unique Word script?!
Or what may the problem be? Usually I get reports within a few hours.
Thank you!
Awesome solution, the script you suggested to Sanjin worked on my iPhone and iPad too (Safari and Atomic Web Browser).
Hi fritteritter,
I've tried your method but for some reason I can't get the cookie to stick.
If I visit http://bm.wel.by/stopcountingme2.html and then run the javascript alert I get a pop up giving the unique phrase.
But if I then browse to another page and run the alert it tells me no unique word is set.
I had previously used the method described by Google which used the deprecated pageTracker method and hoped that your instructions would replace that functionality but I don't seem to be having any joy.
Are there any insights you can lend me? Thanks
Hi, I tried your method, it seems really simple and when I retrieve the word using the code you wrote I get a popup with my secret word. I configured the filter on a profile on Analytics with the same word but Analytics keep tracking my own visits. I am sure I did everything correctly but I must be missing something. Do you have any idea or know about a common mistake that leads to this? Thank you very muchª
"Some admin systems such as WordPress may not include analytics tracking on administrative pages. While it may seem counterintuitive, you may need to paste your Google Analytics code snippet into the admin page as well in order to make the above code work."
I have WP and the steps aren't working. I know what the admin page is but I don't know how to paste the GA code in. Nor does it really make sense why I would need to paste the GA tracking code there.
Fritteritter,thanks for quick reply. I tried that already by keeping that code as link on a sample page. I got the alert message after setting with given value. I have Android OS, still I am not seeing any change. Not sure, are we setting the proper value or not? Or something might be changed with new Google Analytics(GA) code. Still GA is showing my mobile visits after adding the exclude word.
You should open your web site and paste that code.
Guys, how could we use the same code on mobile browser? Is it same or different? When I tried, it is not saying any error or showing alter box with my word.
when i try to run this in firefox, i get message : pagetracker is not defined?
Thanks so very much! It was easy enough that even I could do it.
Found it. _utmv Expires: March 11, 2012 5AM. Obviously not good for two years. Is there a way to change it?
May still be having an issue, however. Will post when I know for sure.
I think I found the problem. I went in and looked at the security settings. I had it set to NOT delete cookies, but there is another level where it was deleting them, apparently, on shutdown. I've now changed that (unfortunately the only other options is "until they expires" which doesn't thrill me because of certain other types of cookies), and so far so good.
Btw, how do I check the _utmv cookie expiration? I don't really know how to do that. I tried googling it with no success. I would like to know myself about the expiry date, although it doesn't seem likely that is the issue after what I found. Still...
Hi there. Yes, this page looks great now. Now for some other annoying news. Firefox seems to be giving grief in all quarters. Using the webconsole route works fine as long as you don't turn off or restart the computer. When you do, Firefox apparently wipes out your lovely code because I start showing up on analytics. So I have to remember on both computers to redo it every time. So far Chrome is behaving itself, so I may have to switch to using THAT browser (sigh).
Any way around that little nuisance? As always, thanks for your great work and help!
Hi again,
Don't know if you're aware of this, and maybe it doesn't matter (other than aesthetically) but when this page is brought up in Firefox, it spreads the exclude and the check your browser codes all the way across the page. The exclude coded even runs under a banner ad and off the page! It's fine in IE and Chrome.
Using latest Firefox. Tried the Web Console solution. How do you test it to ensure that the site is set up with the cookie?
Yes!!! fritteritter you're the best! Thanks so much for the lightening-fast response and fix! I love this code!
PS - I was necessary to redo the exclude code in Firefox last week (have no idea when or why it got removed, possibly on another upgrade), and it worked fine then, so I'm suspecting something with yesterday's upgrade.
fritterritter, been using this great code for over a year and LOVE it! Thank you! Firefox, however, is becoming a pain with their updates that blot things out and don't work with certain add-ons anymore.
It just did another update yesterday and it blotted out the exclude code yet again. When I checked my analytics just now and found myself included, I redid the code, but no cigar. I copy/pasted as usual into the addy bar, hit enter, and... no box, no nothing.
Popups are allowed for my site, and I also disabled popup blocker completely while doing this just to be sure, also cleared cache, and it still won't work. Thanking you in advance for your help!
Has there been any changes recently?
I used the latest code and Chrome and was able to setup the unique word, however Analytics still counts my visits. Also, every time I restart my PC the cookie gets deleted?
Could this be a Chrome issue? Let me try Firefox and IE and see.
big thanks
Just an FYI: been using this script great with no problems but recently had to clear out Chrome cookies and re-do everything. Ran into a problem with Chrome also removing javascript from the beginning. So anyone having any issues with getting this to work with Chrome, make sure you go to the very beginning of the address bar and type in 'javascript:' before hitting enter - otherwise you'll just run a google search.
Works great! Thank you, thank you, thank you :-)
nice...googling for "analytics dont count me" and find this article. Thanks fritteritter.
This is amazing! So easy to implement, and easily the best guide for excluding yourself from Analytics to be found on the Internet... Thanks ;)
I'd been pulling my hair out over this one - until I found this article.
Excellent work - being bookmarked for future reference!
Thanks for writing this.
Cheers,
Alex
Thanks for the response fritteritter. You were 100% correct. Typing "Javascript" by hand sorted the issue out for me.
Hugely appreciate your help with this!
236