Site icon Nabtron

How to stop Google Analytics from recording my own page views – excluding visits on dynamic IP too

Google analytics, undoubtedly one of the main tool used by webmasters and website owners to track their visitors statistics on blogs and websites. It’s mostly accurate, but to make it more accurate, you might want to exclude your own visits to your website (or of team members).

In this tutorial, you will learn how to setup filters in google analytics to exclude logging your own visits to your blog or websites, thus avoiding google analytics code from recording your own page views to your stats.

How to setup filters in Google Analytics to exclude your own page views

1. Creating a Custom html file

We need to create a custom file before we proceed to Google Analytics part. This custom file has to be a custom html file to be accessed on the computer which you want to be excluded from google analytics by using filter.

Name the file exclude.html (or anything else you want). Add this to the body opening tag:

<body onLoad="javascript:__utmSetVar('no_report')">

You have to run open this page once on the browsers / computers that you want to be excluded from google analytics stats. This code will create a cookies for that browser with  “no_report” in it.

2. Create a Custom Filter in Google Analytics

Login to Google Analytics account by going to Google.com/analytics

Once logged in and on the dashboard for your google analytics account, goto bottom of the analytics home page and find Filter Manager  Click it to goto Filters manager page. This page lists filters that you’ve created for sites in your google analytics account.

Create a new filter by clicking Add filter

Give name to the filter (I named it Exclude My Visits)

From the options for Predefined or Custom filter, select the radio button for Custom Filter

From next row chose: Exclude 

Chose Filter Field to be user defined

Enter Filter Pattern to be no_report

Chose Case Sensitive to be No

Select the sites you want this filter to be applied to (I selected all of them) and Save Changes

Note: it’s recommended to change “no_report” to any custom name both in custom filter and body tag so that it don’t interfere with any other user coming to your site with this cookie active in his browser.

3. Test your settings

To test and confirm your settings, make a new page (e.g: tester.html other than exclude.htm) on your website and add normal google analytics code to it. Now open it couple of times before running that exclude.html file (so that the hits get logged)

Check the stats after 24 hour and confirm that the hits are being recorded in Google Analytics

Now run the file exclude.html to apply the filter cookie so that google analytics excludes it now. Run the tester.html few times and check the stats again after 24 hour and it shouldn’t show it (if you used the same computer and browser without cleaning the cache ofcourse)

Now google analytics won’t record page views from your own computer even if you’re visiting your website or blog over a dynamic ip address and not just static.

Feel free to ask any questions if you have.

Exit mobile version