Account structure
When you setup a website in Google Analytics, it is added as a property under your account. An unfiltered view is automatically created for your property but you can set up additional views if you are looking to only display a subset of data in your reports. This could be a subdomain of your property or a staging site for example. To do this, you will need to setup filters so each view will display the data set you are looking for.
Views
As a starter, I recommend to always have a “catch all” view for your property. This will allow you to have access to all the data being collected before it is filtered. However, you should also create an additional view that would only display data for your “live” website. This way your reports won’t show data from sessions that occurred on your testing site, mobile app, or other system you have setup on a subdomain for example. For these, you should create additional views.
Creating filters
Once you have determined the “views” you are going to use, you will need to create filters for each view. You can do this in the “Admin” area under “Filters”.
Some basic filters
Although filters offer endless possibilities, there are some basic filters you should have setup for your properties.
IP exclusion
This will allow you to remove data from specific IP addresses in your reports. For example, you might not want your reports to include traffic from your own team. To do this, first select the “Predefined” option under “Filter Type”. Then select “Exclude” option under the “Select filter type” drop down menu.
After this, select the “traffic from the IP addresses” option under the “Select source or destination” drop down menu.
Finally, select “that are equal to” under the “Select expression” drop down menu. This will add a text field to enter the IP address you wish to exclude.
Exclude traffic to your subdomains
This filter allows you to exclude data from your subdomains so your reports only include data from your main domain.
For example, you might not want your reports to include traffic from your development site or mobile site. To set this up, the steps are similar to the first filter I covered for the IP exclusion. You first need to select the “Predefined” option under “Filter Type”. Then select “Exclude” option under the “Select filter type” drop down menu.
The second step is to select “traffic to the hostname” under the “Select source or destination” drop down menu. This will add a text field (hostname) to enter a regex pattern for all subdomains you wish to exclude from your reports. If for example, you wish to exclude data from a development site on stage.yourdomain.com and a mobile site on m.yourdomain.com, you would enter ^stage\.yourdomain\.com$|^m\.yourdomain\.com$ in this field (or some similar Regex).
To help you with this, here is the meaning of the characters used in the regex example above:
^ = “starts with”
$ = “ends with”
.* = match any possible character (“get anything”)
\ = make the following character (the character after the \ ) into plain text (“\.” means make the dot an actual dot)
| = “or”
Only include traffic to a specific subdomain
Just like you can exclude subdomains, you can also only include a specific subdomain into your report. This could be useful if for example, you have a “View” for a blog, mobile site or development environment you had setup on a subdomain. The required steps would be the same as when you exclude subdomains except that you would have to select “include only” under “Select filter type”.
Only include traffic from a specific hostname
This is another great filter to use. It works the same way as in the subdomain inclusion filter above but with the difference that you would apply the filter to your hostname (your domain). This filter is useful if you are looking to reduce ghost referral spam. The regex for this would be something like ^(www\.)?yourdomain\.com$
Custom filters
This filter type allows you to include or exclude data based on specific fields such as referral, application ID, country and region to name a few. You can view the full list here. It can be useful for a variety of situations.
If for example you have sales rep for specific countries, you can set a filter with a custom field to filter your data by country. Since you can manage users for each View, you could create a View for each sales rep using this filter so they would only see data for the country they cover.
Conclusion
Filters offer so many possibilities to clean up your web analytics and display data that has value to you. I encourage to apply the examples provided above and experiment with custom fileds.
Happy filtering!