I have created a new site which is currently only getting a low amount of traffic. There is a beta version of the site live at the moment but it is still in development too. My problem is that Google Analytics is still tracking page views on my local machine during development because the Google Analytics tracking code is on the local version too.
I do not want any hits that are a result of me testing my development site or staging site to count towards the total page views and unique visits recorded in Google Analytics. Since there are only low amounts of traffic at the moment my development will dramatically skew the analytics results.
I tried a few ways to control the analytics recordings by using filters in the Google Analytics dashboard but made some mistakes which destroyed all tracking before I finally got it right. Whoops... So to make sure you get it right first time here is how to do it.
How to filter page views from your local or development site
- Go to you Google Analytics dashboard by clicking on "Analytics Settings"
- Click "Filter Manager »"
- Click "Add Filter"
- Name the filter
- Select the "Custom filter" radio button
- Select "Include" radio button
- Choose "Hostname" as your Filter Field
- And type in "^www\.mysite\.com$" as your Filter Pattern (without the quotes)
- Select case-sensitivity. I chose "No"
- Add your website profile to the selected website profiles
- Click "Save Changes" button