How to setup some of the most common Google Analytics filters and how you can use them to customize your own view filters and organize your traffic for marketing success.
Setting up Google Analytics is simple: you add the script to the right place on your website and you are good to go. By default, using Google Analytics will collect data from all website visitors from the day you enable it.
As intended, Google built its analytics platform to be able to adapt to the needs of most businesses both large and small. Marketers have found uses to maximize and clean up the platform for their companies which have made their way into the standard platform we have today.
Filtered Views are best used by marketers for the following:
Testing how changes affect analytics data.
Error checking for analytics.
Most Common Google Analytics Filters (that we’ve come across)
- When do you not need to use a filter in Google Analytics?
- Excluding the Internal IP (so your employees clicks/visits aren’t skewing the results)
- Excluding the Development or Staging Sites (so your developers aren’t skewing results)
- Including Hostnames & Subdomains in Reports (so you can see cross-domain hostnames in reports and ensures tracking code reliability for subdomains)
- Normalizing the Ending Slash (so your pages have a “/” at the end by default)
- Lowercasing the Pages (normalizes the page names with case-sensitivity)
- Lowercasing the UTM Parameters (so your data is normalized with case-sensitivity)
What is a Filter?
Filters are a way that Google Analytics has provided Marketers with the ability to organize their website traffic. The structure of every Google Analytics instance is as follows:
Account > Property > View
The Account
The account is the highest tier in Google Analytics and represents the overall company or entity that governs all of the properties beneath it. Users who have access to Google Analytics accounts can modify the overall settings and control filters that affect every property beneath them. You can have access (per user) to 100 maximum accounts.
The Property
The property is the second tier in Google Analytics and represents the entity tied to a single tracking code. Often this aligns with individual hostnames and domains (Ex: CallSource.com). Users who have access to Google Analytics properties can modify the property settings and how it connects and integrates with other tools. The maximum is 50 per account.
The View
The view is the subset of an individual property which has its own configurations, settings, and definitions of data within the property. Users who have access to Google Analytics views can modify only the view settings, configurations, and definitions within that view. The maximum is 25 per property.
View Filters
Filters are tools provided by Google Analytics to limit, control, and modify the data being collected within the View. Filters are only available within the View settings but you can see the overall Filters at the Account level.
The biggest limitations of using filters is that the actions you take with filters alters data permanently going forward. Adjusting a filter in the future will not apply the new filtering rules retroactively (Filters do not apply to backdated data only data moving forward). Filtering applies to the data after it has been processed (usually 24-72 hours after collection). If you messed up in the past without a raw view(s), then you are in trouble (I’ll show you how to protect yourself).
What is the difference between filters and sampled segments?
- Filters can only include or exclude based on dimension fields.
- Filters only apply to the present and future facing data.
- Filters require a user with higher level (edit access) to create and modify.
- Filters cannot be shared.
- Filters apply to near endless timeframes going forward (are not limited to a window of time)
- Filters are not subject to additional sampling. (This is huge!)
Setting Up and Managing Multiple Views
This is important! Before you start creating filters… please setup additional views! At the very least, create two additional views called: Raw and Testing. The Raw View will be the view where you have no filters applied (that’s right, 0!). You need this one because if you ever need to see what change filters had on your data you need a ‘backup.’ The Raw View provides this backup.
The second view you need to make is a testing view where you can play, mess up, change, and alter filters without messing up your primary views. The Testing View is especially important as you add new tools and integrations because filters can sometimes (they do) break down due to filters. Try to keep the Testing View empty after you’ve testing things unless you are running a long term test.
Wait – How Do I Create New Views in Google Analytics?
Here are the steps to locate and create Views in Google Analytics:
- Login to your Analytics (https://analytics.google.com).
- In the lower right of your screen (Desktop) navigate to the Admin Panel (Gear Icon).
- From the Admin Panel, the furthest right column is for Views, click the blue (+ Create View) button.
- Select what data you are wanting to track (Website or Mobile App, etc).
- Name the New View, and set a time zone (Usually to Your Time Zone), then save it.
- Select the New View by what you named it, using the dropdown beneath the blue (+ Create View) button from before.
Where Do I Find View Filters in Google Analytics?
Now that you have some Views ready for filtering you can use the Testing View to add some filters and make sure that nothing in the primary views will be affected. Adding filters is up to you – don’t just add everything without considering if it will impact something important.
Here are the steps to locate and create a filter:
- Login to your Analytics (https://analytics.google.com).
- In the Lower right of your screen (Desktop) Navigate to the Admin Panel (Gear Icon).
- From the Admin Panel, the furthest right column is for Views, make sure you are in the right view, the fifth row item down is called Filters (funnel icon). Click this.
- The Filters are ordered into a ranking of what will run in what order (order matters a lot).
- In red (currently) click the button (+ ADD FILTER) to create a filter for the view you intend.
- You will create a filter, verify it, and save it each time.
- If you ever need to change the order, click the text beside the button “Assign Filter Order” to reorder the filters.
What are the Required Fields in a New Filter in Google Analytics?
When you create a brand new Filter in Google Analytics the first field you will always need to fill out is the Filter Name. Next you will be required to select if the Filter Type will use predefined fields and rules or if you are going to go ‘full custom.’ Predefined selections are limited to filtering traffic exclusively from:
- ISP Domains
- IP Addresses
- Subdirectories
- Hostnames
Getting started the predefined selections might suffice for basic purposes but will not suffice for more complex filtering needs.
While it is not required using the Filter Verification and ‘Verifying this filter’ could save you a lot of time. The Verification will apply the new rule to the past 7 days of data and pulls a small sample of what changed to simulate how it could affect you. Since it does not give you a full picture, it’s more directional if the filter works or did not worked. Sometimes there is not data because what would have been filtered has not occurred yet.
When do you not need to use a filter in Google Analytics?
We have found that some cases are not necessary for filtering. Sometimes filtering is either overkill or Google has another feature that negates the use of filtering. Due to sampling, simply creating a segmented view of the data is prohibitive since sampled data is not always reliable (sometimes in rare circumstances the sampling is 99.99% so it’s okay).
The best example of this is excluding URL Query Parameters which can be achieved using a feature of Google Analytics. Navigate to your Google Analytics in the Admin panel:
View > Select View > Click View Settings > Scroll Down to “Exclude URL Query Parameters”
Inside the Text Area box you can add your Query parameters you want removed separated or delimitated by commas. We have seen email automation queries in there, language modifiers, and other personalization-based query parameters in this box so they do not add unnecessary pages in reports. If you see a lot of pages in reports with query parameters, consider adding them here.
The Order Matters with Multiple Filters
Each Filter is not applied all at once or independent of other Filters. Instead Filters work in the order they are Ranked, one at a time. This is a big reason why it’s important to build the filters in a Testing View before you move them to your primary property (as mentioned).
Here is a visual example of how multiple filtering works:
Example #1: Assume you need to include two hostnames (two domains) that are ‘firstdomain.com’ and ‘seconddomain.com’ in a filtered view so you can see both of them in reporting.
If you run the filters in the following order what happens?
- Include hostname contains firstdomain.com
- Include hostname contains seconddomain.com
Result: FAIL only traffic from the first step will be in reporting = data from ‘firstdomain.com’
What about if you flip the filters into the reverse order what happens?
- Include hostname contains seconddomain.com
- Include hostname contains firstdomain.com
Result: FAIL only traffic from the first step will again be in reporting = data from ‘seconddomain.com’
In order to get data from two values you need to put them into a single REGEX-based filter. The result would look like:
- Include hostname regex: firstdomain.com|seconddomain.com
Result: SUCCESS traffic from both domains will be in reporting = data from ‘firstdomain.com’ and ‘seconddomain.com’
Example #2: Assume you needed traffic from the page /cars/ but wanted to exclude traffic from the page /car/
If you ran the filters below in the following order what happens?
- Exclude Request URI car
- Include Request URI cars
Result: FAIL no data from /cars/ would not show up because the word ‘car’ is found in the word ‘cars’ so the first exclusion would remove data from both ‘car’ and ‘cars’ pages.
If you run the filters below in reverse order what will happen?
- Include Request URI cars
- Exclude Request URI car
Result: FAIL no data from /cars/ would show up because the first step does limit the pages to those with ‘cars’ but the second step, as before, finds ‘car’ in the word ‘cars’ and excludes it.
So how do I create the successful filter?
The example I choose was simplistic to emphasize the importance of the order but the solution is actually pretty simple. The trouble is using words without placement of the word makes it difficult to create a filter. When you create a filter make sure you test it in a regex tester to validate that you have it correct. My favorite RegEx tester is RegEx Pal (https://www.regexpal.com/) which allows you to create an expression at the top and then write different test strings to see if your expression worked.
The correct expression (works in reverse):
- Include Request URI /cars/
- Exclude Request URI /car/
Result: SUCCESS you will see data only from /cars/ but not from /cars/ because the whole word ‘/car/’ with the forward slashes is not found in /cars/.
How do I test to make sure that my Filters are working as intended?
In many cases you will not be able to stare at the filter logic and know that it will be successful or fail. Sometimes it seems like it has succeeded and you will have to check it against the RAW View to be certain. When creating and testing Filter Views it helps to have a process of how to create and diagnose your filters that saves you time and efforts.
Here are some steps I take to validate filters as I create them:
- Always have a RAW View in the property I’m adding Filters to
- Always first apply the Filters to the Testing View
- Test the results using the Real-Time Data View in Google Analytics by replicating an environment that would should be filtered out (not always possible)
- Alternatively… open up the relevant report in Google Analytics and apply my RegEx to the advanced settings of the correct dimension.
- If I cannot verify immediately give the Test View a few days or weeks to validate.
- Compare the RAW to the Testing View to see if things are working.
- If needed Create another Testing View with the opposite (if it’s include, make it exclude) Filter Logic and check the data that way.
Setting up each of the Most Common Filters in Google Analytics
Excluding the Internal IP (so your employees clicks/visits aren’t skewing the results)
Why should I use this filter?
Organizations that test their own systems and run through their marketing processes will leave view, clicks, form fills, and more behind. You’ll see landing pages with high clicks, high conversion rates, and emails with amazing delivery. While internal testing can account for seeming negligible data it can still skew results. Unless you plan to adjust dates or remove the data later from reports then adding this filter cleans up your data automatically.
Additional Tip:
Before you create this filter, add a view to your property called “Internal Only” and only include traffic from your internal IP. That way, if you ever wanted to see the internal traffic you can load that view and see it. This might also allow you to see internal pages or internal wiki and media assets to know what your internal team is looking at.
Creating the Filter (Step by Step):
- You will need to know the IP Address(es) of your internal organization that it uses to connect to the internet. If you do not know ask your IT professional. You might try searching on Google for it but this might not be your actual IP (https://www.google.com/search?q=whats+my+ip&oq=whats+my+ip)
- Name the Filter, you can use, “Exclude Internal IP”
- If you have a single IP Address it’s simple to use the Predefined Filter Type:
- Set to Exclude
- Set Traffic to, “traffic from the IP addresses”
- Set Match to, “that are equal to”
- Set IP address to your single IP Address
- If you have multiple IP Addresses then use the Custom Filter Type:
- Select Exclude
- Set Filter Field to, “IP Address”
- In the Filter Pattern type your IP Addresses using RegEx each separated using ‘|’ between each IP and each number of the IP escaped by a backslash ‘\’:
- Example: 100\.100\.100\.100
- If you need help with this there is a tool that will convert your IP Address into the RegEx, 3rd party tool here (http://www.analyticsmarket.com/freetools/ipregex)
- Save it
What about the order of this filter?
Due to this being an overarching filter and if there are not multiple filters for IP Address then you could leave this at the top of the rankings so it runs first. Please… test this and run all of your initial filters in a test view to make sure they work as intended.
Excluding the Development or Staging Sites (so your developers aren’t skewing results)
Why should I use this filter?
For the same reasons that you might exclude Internal Traffic from a view you might want to exclude development and staging sites from your analytics. Undeveloped and ‘Work in Progress’ development environments can easily skew (even in small numbers) the data because of bugs and issues. If you plan on removing it later then you might not need to add this filter.
Additional Tip:
Before you create this filter you need to confirm with your developers what denotes a development or staging environment from the live site. If it’s a subdomain, a query parameter, or specific pages then you need to know this because they have different setups.
Creating the Filter(s) (Step by Step):
- Determine what denotes your Development or Staging environments
- Name the Filter, you can use, “Exclude Staging Development”
- You (most likely) must use the Custom Filter Type.
- If you use a subdomain for staging:
- Set to Exclude
- Set Filter Field to, “Hostname”
- In the Filter Pattern add RegEx for all of your staging subdomains:
- Example: ^staging\.yoursite\.com$|^development\.yoursite\.com$
- Example: (^staging|^development)\.yoursite\.com$
- If you use a page for staging:
- Set to Exclude
- Set Filter Field to, “Request URI”
- In the Filter Pattern add Regex for each of your known staging subdomains:
- Example: /(staging|development)/
- Validate and Save
What about the order of this filter?
The order of this filter is determined by the position of other filters that interact with either the Hostname or the Request URI. You might want to place this higher than filters that add or replace elements of either. Always test if you are unsure first in the Testing View.
Including Hostnames & Subdomains in Reports (so you can see cross-domain hostnames in reports and ensures tracking code reliability for subdomains)
Why should I use this filter?
Whether or not to use the include Hostname filter depends on if you can answer yes to two questions: are you confident that your tracking code is only on your active and current domains? And – do you have your property on a single domain with no other subdomains? If you answered yes to both then you likely do not need this Filter. Otherwise, try testing this filter out to see if you can get cleaned up cross-domain data.
Additional Tip:
Once you have a list of all of your domains, subdomains, and even link shorteners like Bit.Ly that touch your analytics property then you need to add them to your referral exclusion list. Inside Google Analytics > Property > Tracking Info > Referral Exclusion List you need to add each of those domains to the referral exclusions. You can always check your referral domains in your reports to see if you ever miss any.
Creating the Filter (Step by Step):
- Gather your list of domains and subdomains
- Name the Filter, you can use “Include Hostnames”
- You must use the Custom Filter Type.
- Select Include
- Set Filter Field to, “Hostname”
- In the Filter Pattern add RegEx for all of your subdomains and domains, along with some google domains that cache and serve data:
- Example: (www|blog|community|subdomains)\.yoursite\.com|yoursite\.com|translate\.googleusercontent\.com|webcache\.googleusercontent\.com
- Verify and Save
What about the order of this filter?
The order of this filter is determined by the position of other filters that interact with the Hostname. You might want to place this higher than filters that add or replace elements of the hostname. Always test if you are unsure first in the Testing View.
Normalizing the Ending Slash (so your pages have a “/” at the end by default)
Why should I use this filter?
Did you know, or are you frustrated that if someone visits the page /contact and someone else visits the same page /contact/ that Google Analytics will load both interactions but they will be noted as two separate pages?
When you look up page views and conversions from that page you will have to combine the data outside of the report to get the metrics. However, this Filter normalizes your pages that have and links that do not have the ending forward slash “/”.
Additional Tip:
It takes more than one person to run marketing. For those of you doing it all… hats off to you. For teams with multiple people and links being created by several people – possibly people across the country from you this Filter reduces the micromanagement around having to make everything match.
Creating the Filter (Step by Step):
- Name the Filter, you can use “Normalize Ending Slash”
- You must use the Custom Filter Type.
- Select Advanced
- Set Select Field to, “Request URI” in Field A -> Extract A
- In the Filter Pattern add RegEx for detecting pages without a “/” forward slash.
- Example: ^([a-z0-9/_\-]*[^/])$
- Example (if above does not work): ^(/[a-zA-Z0-9/_\-]*[^/])$
- Leave the Field B -> Extract B blank and do not Set Anything in the Select Field
- Set Select Field in Output To -> Constructor to, “Request URI”
- In the Filter Pattern type: $A1/
- Make sure that Field A Required & Override Output Field are both checked
- Verify and Save
What about the order of this filter?
The order of this filter is determined by the position of other filters that interact with the Request URI. You might want to place this higher than filters that add or replace elements of the page or Request URI. Always test if you are unsure first in the Testing View.
Lowercasing the Pages (normalizes the page names with case-sensitivity)
Why should I use this filter?
Normalizing page names keeps the pages consistent in reports and consolidates the duplication of pages that have different case-sensitive names.
Additional Tip:
If you have a use case for some pages to be first letter capitalized, then do not use this Filter. Using this filter makes your data more consistent and reduces needless duplication of pages in your reporting. The page URL is what is being considered here – not the actual name of the page by its title.
Creating the Filter (Step by Step):
- Name the Filter, you can use “Normalize Page URLs”
- You must use the Custom Filter Type.
- Select Lowercase
- Set the Filter Field to, “Request URI”
- Verify and Save
What about the order of this filter?
This filter does not impact other filters unless they are case-sensitive. Test in the Testing View to be certain.
Lowercasing the Query Parameters (so your data is normalized with case-sensitivity)
Why should I use this filter?
UTM Parameters are easily mixed up, capitalized, and incorrectly typed. If you have one person doing them for Social Media, another for Advertising, and another for Emails you will have a lot of cross-over. This can compound the issues and makes normalizing the UTM parameters to be lowercase (as they should be) a must.
Additional Tip:
UTM Parameters should always be lowercase. Consider making yourself a tool in excel or google sheets that helps you keep track of your UTMs and build them that enforces lowercase. That way everyone can have their own tool but be forced into normalized UTMs at the beginning.
Creating the Filters (Step by Step):
- Name the Filters, you can use “Normalize UTM {Insert Parameter Name}”
- You must use the Custom Filter Type.
- Select Lowercase
- Set the Filter Field to each UTM (one at a time so each parameter needs its own filter):
- For Campaign, “Campaign Name”
- For Source, “Campaign Source”
- For Medium, “Campaign Medium”
- For Content, “Campaign Content”
- For Term, “Campaign Term”
- Verify and Save for Each Parameter
What about the order of this filter?
This filter does not impact other filters unless you are using Filters that rely on the Filter Fields (Campaign Name/Source/etc). Test in the Testing View to be certain.
What Filters Should I Not Use?
This is subjective, but from personal experience I can say that you should not use resolution (screen size) based filtering because it will negate any API/Webhooks you have coming into Google Analytics. A webhook of information coming from an integration will not have a screen size so the data it contains will be lost if you do not include it in or if you exclude it out.
Finally, there are circumstances where (if you are not specific enough) the filters do more harm than good. Remember, including means that only the matched filter pattern will be allowed and excluding means that anything besides the excluded filter pattern will be allowed into the final data.
Additional Views to Explore from Filtering
- Mobile Only (Include Device Type) [Be careful because devices are not always identified well]
- Blog Only (Include Blog)
- United States Only (Include Country) [Be careful with this due to VPNs and other elements that can limit this]
- Specific Language Only (Include Language) [Be careful with this as many people are bi-lingual]
- Stripped Query (Search and Replace Query Strings)
- Normalized Site Search (Lowercase Search Terms)
- Paid Traffic Only (Include Source/Medium/Referral) [Be careful that you can identify this perfectly]
- Browser Only (Include Browser) [Be careful because browsers are not always identified well]
Additional Custom Filters to Investigate
The community of Google Analytics helps Google by identifying spam, bots, web crawlers, and applications that should be filtered but are not. Currently the community has a comprehensive list of known spam, robots, and crawlers which are known to potentially inflate traffic counts.
Competitors are known to track their competition brands by scanning the changes of their website on a daily even hourly basis. Some of those filters are updated as new ones are discovered or Google lets the community know they have accounted for them.
The current list of spam, robots, and crawlers you can add filters for are found below with how to setup each filter. Please test these in case – you’ve been warned.
Known Spam
- Name the Filter, you can use “Block Spam #X”
- You must use the Custom Filter Type
- Select Exclude
- Set the Filter Field to, “Campaign Source”
- Type the following Filter Patterns:
- .*((darodar|priceg|buttons\-for(\-your)?\-website|makemoneyonline|blackhatworth|hulfingtonpost|o\-o\-6\-o\-o|(social|(simple|free|floating)\-share)\-buttons)\.com|econom\.co|ilovevitaly(\.co(m)?)|(ilovevitaly(\.ru))|(humanorightswatch|guardlink)\.org).*
- .*((best(websitesawards|\-seo\-(solution|offer))|get\-free(\-social)?\-traffic(\-now)?|googlsucks)\.com|(domination|torture)\.ml|((rapidgator\-)?(general)?porn(hub(\-)?forum)?|4webmasters)\.(ga|tk|org|uni)|(buy\-cheap\-online)\.info).*
- .*((event\-tracking|semalt(media)?|(100dollars|success)\-seo|chinese\-amezon|e\-buyeasy|rankings\-analytics|rednise|video\-\-production|theguardlan|webmaster\-traffic)\.com|traffic(monetize(r)?|2money)\.(org|com)|pops\.foundation|erot\.co).*
- .*(((free\-)?(floating|get\-your\-social)\-(share\-)?buttons|hosting\-tracker|alibestsale)\.(com|info)|(justprofit|best\-seo\-software)\.xyz|snip\.to|adf\.ly|copyrightclaims\.org|(black\-friday|cyber\-monday)\.ga).*
- .*((monitoring(-your)?-success|uptime|free-video-tool|hdmoviecams)\.com|(monetizationking|popads)\.net|rank-checker\.online|(marketland|dominateforex)\.ml|(ownshop|topquality|easycommerce)\.cf|increasewwwtraffic\.info|(unpredictable|getlamborghini)\.ga).*
- .*((eu-cookie-law-enforcement|social-traffic).*\.xyz|teedle\.co).*
- .*(semalt(media)?|buttons\-for\-website)\.com.*
- uptime(robot|bot|check|\-|\.com)|vitaly|sharebutton|semalt|ranksonic|share\-button|anticrawler|timer4web|free\-video\-tool|responsive\-test|dogsrun|fix\-website\-er|dailyrank|sitevaluation|99seo|top10\-way|seo(\-2\-0|\-analysis)\.
- (videos|buttons)\-for\-your|best\-seo\-(solution|offer)|buttons\-for\-website|profit\.xyz|dbutton|keywords\-monitoring|platezhka|7makemoney|forum69|kings\-analytics|checkpagerank|pr\-cy\.ru|\-\-(production|website|sale)\.com
- (express|audit|dollars|success|top1|amazon|commerce)\-seo|free\-video\-tool|datract|hacĸer|ɢoogl|slifty\.github|\-liar.ru|3\-letter\-|foxweber|free\-fbook|goodwriterssales|your\-rankings|tourcroatia|spinnerco|justkillingti|suralink|worldtraveler\.w
- oldfaithfultaxi|christopherlane|hollywoodweeklymagazine|losangeles\-ads|anniemation|timdreby|pcimforum|yellowstonesafaritours|autoseo|blogarama|for\-placing|brainwizard|casinos4|ḷ\.com|\-backlinks\.com|phoenicx\.co\.uk|be\-escorts|vidyoze
- brasseriebread|helvetiiconsulting|johntrapane|cloudsendchef|theautoprofit|:8888|blog1989|incomekey|amazon\-ads\.ovh|krumble\.net|10bestseo|seo\-watch|blog100|seoservices2018|resell\-seo
- Verify and Save
Known ISP Provider Crawlers
- Name the Filter, you can use “ISP Spam”
- You must use the Custom Filter Type
- Select Exclude
- Set the Filter Field to, “ISP Organization”
- Type the following Filter Pattern:
- hubspot|^google\sllc$|^google\sinc\.$|alibaba\.com\sllc|ovh\shosting\sinc\.|microsoft\scorp|facebook\sireland\sltd
- Verify and Save
Known ISP Domain Robots
- Name the Filter, you can use “ISP Robots”
- You must use the Custom Filter Type
- Select Exclude
- Set the Filter Field to, “ISP Domain”
- Type the following Filter Pattern:
- paloaltonetworks|scaleway|kcura
- Verify and Save
Known Language Spam
- Name the Filter, you can use “Language Spam”
- You must use the Custom Filter Type
- Select Exclude
- Set the Filter Field to, “Language Settings”
- Type the following Filter Pattern:
- \s[^\s]*\s|.{15,}|\.|,|^c$
- Verify and Save
Conclusions
I tip I found online that I wanted to share is that if you are testing RegEx you can always bring up the related report in Google Analytics and open their advanced settings where you can enter your RegEx and see if it displays the right data.
Another rule of thumb is to try to only include one filter of each Filter Field Type. If you run out of room (as in the case of the spam/robots/crawlers above), then it makes sense to have multiples of the same type.
CallSource is not affiliated with Google Analytics, but we provide solutions for businesses that want to track and attribute their phone calls online.
If you are interested in learning more, contact a Specialist to find out about our non-cookie based digital attribution platform, AutoID.