Top Google Analytics filters for every website

Following are the top Google Analytics filters for every website: 

  1. Exclude internal and third-party agency traffic
  2. Exclude dev and staging traffic
  3. Include internal and third-party agency IP
  4. Include specific domain or hostname
  5. Add hostname to pages
  6. Lowercase page URL (request URI)
  7. Lowercase site search term
  8. Lowercase campaign names
  9. Search and replace
  10. Include device category
  11. Include traffic source/medium

Before we apply filters it is strongly recommended to have the following three Google Analytics views for your GA property:

  1. Unfiltered view (raw data): You should always have an unfiltered analytics view which contains all of your data without any filter. This view can be used as a backup if any data issues happen in other views. No filters should be applied to this analytics view.
  1. Main view (reporting view): This view should be used for reporting purposes. This view will have all your filters applied to the data once they are verified and tested in test view.
  1. Test view: Test view can be used for testing purposes. This view will be a replica of the main view but you will use this view only for testing filters for a few days. Remember after applying filters you will only see the data that you allowed to pass in through filter configuration. The filtered data will never be reported and it’s gone forever. It is better to have a test view where you can verify the filter configuration is working properly and then you can replicate those in the main view. 
 
Get the E-Book (50 Pages)
 
Get the FREE E-Book (50+ Pages)

Top Google Analytics filter #1:
Exclude internal and third-party agency traffic 

Generally your internal employees and the third-party agency visits on your website on a regular basis to check site functionality or campaign validation. 

This will generate data from internal users and external users and it will be difficult to check how actual customers are interacting with your website. 

You can use this filter to exclude the traffic from internal employees and all the third-party agencies you work with. 

Follow the below steps to create this filter:

Step-1: Navigate to your Google Analytics account and click on the ‘Admin’ option.

Step-2: Select the property from the ‘Property’ column.

Step-3: Select the required view from the ‘Views’ column and click on ‘Filters’.

Step-4: You will get an overlay like below. Click on ‘Add Filter’:

Step-5: Give your filter a valid and easy to understand name.

Step-6: Now you need to select the filter type. There are two types of filter; one is ‘predefined’ and other is ‘custom’. 

  • Predefined filters are used only for traffic-related data like include or exclude traffic.
  • Custom filters can be used with the majority of Google Analytics dimensions. 

You can get the list of all applicable fields here: Custom filter fields

Select ‘custom’ as the filter type and then click on the ‘Exclude’ radio button.

Step-7: Now click on ‘Select Field’ and select ‘IP address’.

Step-8: In ‘Filter Pattern’, type the range of IP addresses using regex. 

Learn more about regex: Regex Google Analytics & Google Tag Manager – Tutorial

Your filter configuration will be like below:

  • Filter Name: Exclude Internal and third-party Agency Traffic
  • Filter Type: Custom
  • Filter Option: Exclude
  • Filter Field: IP Address
  • Filter Pattern: ^192\.100\.0\.1$|^192\.168\.0.$

Note: Change your IP address in ‘Filter pattern’ according to your list.

Step-9: Now click on ‘Save’ and you’re done.

Top Google Analytics filter # 2:
Exclude dev and staging traffic 

You can use this filter to exclude traffic from your development and staging environment to the main production view. 

Filter Configuration

  • Filter Name: Exclude Dev and Staging Traffic
  • Filter Type: Custom
  • Filter Option: Exclude
  • Filter Field: Hostname
  • Filter Pattern: ^dev\.example\.com$|^stage\.example\.com$

Note: Change your regex in ‘Filter pattern’ according to your hostname.

Top Google Analytics Filter #3:
Include internal and third-party agency IP

It is recommended to create a separate Google Analytics view only for internal traffic. Then you can use this filter to include traffic from internal employees and all the third-party agencies you work with. 

Filter Configuration

  • Filter Name: Include Internal and third-party Agency IP
  • Filter Type: Custom
  • Filter Option: Include
  • Filter Field: IP Address
  • Filter Pattern: ^192\.100\.0\.1$|^192\.168\.0.$

Note: Change your IP address in ‘Filter pattern’ according to your list.

Top Google Analytics filter #4:
Include specific domain or hostname

This filter is very useful if you are tracking more than one website or domain. Another use of this filter will be to exclude referral bot traffic from multiple domains to your website. 

Learn more about bot traffic: How to Stop Google Analytics Spam – Remove Referral Spam

Let’s take an example, suppose you have placed your tracking code on ‘optimizesmart.com’ and ‘blog.optimizesmart.com’, and you have created separate analytics views for each.

In this case, you would like to see data separately on the blog view and only for blog pages. Hence you can create a filter to include the hostname, like below:

Filter Configuration

  • Filter Name: Include blog.optimizesmart.com Only
  • Filter Type: Custom
  • Filter Option: Include
  • Filter Field: Hostname
  • Filter Pattern: ^blog\.optimizesmart\.com$

Top Google Analytics filter #5:
Add hostname to pages

This filter is very useful if you have implemented cross-domain tracking on the website. This filter will add the hostname at the beginning of the pages.

For example, suppose you are tracking ‘abc.com’ and ‘xyz.com’ and both have similar url architectures. The home page of both websites will show as index.html in your cross-domain reporting view so you will get confused about what was the hostname that bought the traffic to the website. 

Hence you can apply the add hostname to pages filter and instead of seeing ‘index.html’ in the reporting view, you will see ‘abc.com/index.html’

Filter Configuration

  • Filter Name: Add Hostname to Pages 
  • Filter Type: Custom
  • Filter Option: Advance
  • Filter Field A: Hostname
  • Filter Field A String: (.*)
  • Filter Field B: Request URI
  • Filter Field A String: (.*)
  • Output to Construct Field: Request URI
  • Output to Construct Field Text: $A1$B1
  • Field A Required Checkbox: Tickmarked
  • Override Output Field: Tickmarked

Top Google Analytics filter #6:
Lowercase page URL (request URI)

This filter is very useful if you have any uppercase words in the URL of the website. This filter will convert all the uppercase word to lowercase.

Filter Configuration

  • Filter Name: Lowercase Page URL 
  • Filter Type: Custom
  • Filter Option: Lowercase
  • Filter Option: Request URI

Top Google Analytics filter #7:
Lowercase site search term

Users on the website can search using any casing. Some users may search for ‘PRODUCTS’, some many search for ‘products’ and a few may even search ‘Products’. 

This filter is very useful if you have any uppercase letters in the site search term. This filter will convert all the uppercase letters to lowercase.

Filter Configuration

  • Filter Name: Lowercase Site Search Term 
  • Filter Type: Custom
  • Filter Option: Lowercase
  • Filter Field: Search Term

Top Google Analytics filter #8:
Lowercase campaign names

It might be possible that in your organisation different campaigns are run by different teams that are likely to have different naming conventions and casing. 

Applying this filter is recommended to convert all campaign names to lowercase, in order to have clean data in your reports. You can also create such filters for other campaign dimensions as well.

Filter Configuration

  • Filter Name: Lowercase Campaign Names
  • Filter Type: Custom
  • Filter Option: Lowercase
  • Filter Field: Campaign Names

Top Google Analytics filter #9:
Search and replace

You can use the search and replace filter to clean or modify data in your reporting. Let’s suppose your website can be accessed using both ‘www.abc.com’ and ‘abc.com’.

In Google Analytics reporting, you will see two rows; a separate row for each hostname. In such a case you can apply a search and replace filter to get just one row.

Filter Configuration

  • Filter Name: Search and Replace Hostname
  • Filter Type: Custom
  • Filter Option: Search and Replace
  • Filter Field: Hostname
  • Search String: ^abc\.com$
  • Replace String: www.abc.com

Top Google Analytics filter #10:
Include Device Category

If you have created separate views in Google Analytics for mobile, desktop and tablet, you can use the below filter to include traffic from a specific device only. 

As an example, I am creating a filter that contains traffic only from mobile devices.

Filter Configuration

  • Filter Name: Include Mobile Traffic Only
  • Filter Type: Custom
  • Filter Option: Include
  • Filter Field 1: Device Category
  • Filter Field 2: Mobile

Top Google Analytics filter #11:
Include traffic medium

If you wanted to check the performance of a particular traffic medium in a separate Google Analytics view, you can consider applying the below filter.

Filter Configuration

  • Filter Name: Include Direct Traffic Only
  • Filter Type: Custom
  • Filter Option: Include
  • Filter Field : Campaign Medium
  • Filter Pattern : Direct

Verifying filters in Google Analytics

Once you apply the filters, it is very important to verify the filters before applying them to the main reporting view. 

Filters require up to 24 hours before they are applied to your data.

You can click on the ‘Verify filter’ option available in the ‘Filters’ settings at individual view level.

Learn more about verifying filters: Filter Verification in Google Analytics – Tutorial

For example, I have created a view in Google Analytics which contains a filter that allows traffic from social media only. The filter configuration is like below:

Once I click on ‘Verify filter’, it gives me a ‘Filter verification’ preview table, like the one below:

The first section contains data before the filter was applied. As you can see, it includes sessions from ‘cpc’, ‘organic’, and ‘referral’. We have applied filters in such a way that it should contain traffic from social media only. 

After the filter is applied, sessions from ‘cpc’, ‘organic’, and ‘referral’ should not be included in the view. We can see the result in the second section.

Frequently asked questions about top Google Analytics filters for every website

What is a filter in Google Analytics?

Filters in Google Analytics allows you to control and modify the data which is included in a Google Analytics reporting view. For example, you can apply filters  to stop internal traffic being reported on your website, in order to have more accurate data.

What are the types of filters available in Google Analytics?

There are two types of filter; one is ‘predefined’ and the other is ‘custom’.

Predefined filters are used only for traffic related data, like include or exclude traffic from particular sources or destinations. 

Custom filters can be used with the majority of Google Analytics dimensions.

Can I apply filters on historic data?

Filters are permanent data control and modification rules and so they work from the day they were created. You cannot apply filters on historically processed data.

What are the most recommended filters for a website?

The top filters you should consider applying on your website are:

Exclude internal and third-party agency traffic
Exclude dev and staging traffic
Include internal and third-party agency IP
Include specific domain or hostname
Add hostname to pages
Lowercase page URL (request URI)
Lowercase site search term
Lowercase campaign names
Search and replace
Include device category
Include traffic source/medium

Register for the FREE TRAINING...

"How to use Digital Analytics to generate floods of new Sales and Customers without spending years figuring everything out on your own."



Here’s what we’re going to cover in this training…

#1 Why digital analytics is the key to online business success.

​#2 The number 1 reason why most marketers are not able to scale their advertising and maximize sales.

#3 Why Google and Facebook ads don’t work for most businesses & how to make them work.

#4 ​Why you won’t get any competitive advantage in the marketplace just by knowing Google Analytics.

#5 The number 1 reason why conversion optimization is not working for your business.

#6 How to advertise on any marketing platform for FREE with an unlimited budget.

​#7 How to learn and master digital analytics and conversion optimization in record time.



   

My best selling books on Digital Analytics and Conversion Optimization

Maths and Stats for Web Analytics and Conversion Optimization
This expert guide will teach you how to leverage the knowledge of maths and statistics in order to accurately interpret data and take actions, which can quickly improve the bottom-line of your online business.

Master the Essentials of Email Marketing Analytics
This book focuses solely on the ‘analytics’ that power your email marketing optimization program and will help you dramatically reduce your cost per acquisition and increase marketing ROI by tracking the performance of the various KPIs and metrics used for email marketing.

Attribution Modelling in Google Analytics and Beyond
Attribution modelling is the process of determining the most effective marketing channels for investment. This book has been written to help you implement attribution modelling. It will teach you how to leverage the knowledge of attribution modelling in order to allocate marketing budget and understand buying behaviour.

Attribution Modelling in Google Ads and Facebook
This book has been written to help you implement attribution modelling in Google Ads (Google AdWords) and Facebook. It will teach you, how to leverage the knowledge of attribution modelling in order to understand the customer purchasing journey and determine the most effective marketing channels for investment.

About the Author

Himanshu Sharma

  • Founder, OptimizeSmart.com
  • Over 15 years of experience in digital analytics and marketing
  • Author of four best-selling books on digital analytics and conversion optimization
  • Nominated for Digital Analytics Association Awards for Excellence
  • Runs one of the most popular blogs in the world on digital analytics
  • Consultant to countless small and big businesses over the decade
error: Alert: Content is protected !!