Do you want to give your Google Analytics filters knowledge a real boost?
I know what you think, filters are a pain. Well, not anymore after your have read this guide!
As you probably know, filters are extremely important. They give you the flexibility to modify the data that is being collected in each of your Google Analytics views.On default, Google Analytics collects data from all of your visitors.
But what if you only want to store a subset of the data in a view?
That’s when Google Analytics view filters are the solution.
Filters and views are the building blocks of your Google Analytics account.
In this article you will learn everything about view filters.
From setting up basic and advanced filters to dozens of tips to effectively work with filters in Google Analytics.
Further, I’ve put together a handy bonus guide that contains the Google Analytics filters I use for my clients on a daily basis. Including examples and best practices not found in this post.
Although I recommend to read the entire article, here are some quick links for your convenience:
- View Filters vs. Table Filters
- View Filters vs. Segments
- Filter Types
- Filter Order
- Filter Manager
- Filters and Related Topics
- BONUS examples
- Concluding Remarks
View Filters vs. Table Filters
Google Analytics allows you to set up view filters within the admin and reporting interface.
Besides that you can work with table filters in the reporting environment.
It’s important that you understand the difference between view filters and table filters.
Take a look at the table below:
As you can see, Google Analytics view filters have a permanent effect on the data that is being collected in a view.
That’s why only users with edit rights are able to set up and configure these filters.
Table filters are for everyone. And a good way to slice and dice through your data without affecting the data stored in each of the views.
View Filters vs. Segments
Both view filters as well as segments can be really useful. However, they serve different needs.
It’s important you know the differences, strengths and weaknesses of both.
In the table presented below you can see the main differences between both segmentation methods:
In this post I won’t dive deeper into segments.
Read the following posts if you want to learn more about Google Analytics segments:
Google Analytics Filter Types
By now you know that you have to be really careful with filters. One mistake cannot be undone.
Let’s take a look at the different filter types before we move to an in-depth overview of useful examples.
Easily said, Google Analytics has predefined (system) filters and custom filters.
It depends on your knowledge level (will soon be increased :-)) and specific needs which ones you should use.
1. Predefined Filters
Predefined filters are easy to set up and don’t require you to be an expert here.
At the moment there are 32 (2 x 4 x 4) unique predefined filter combinations.
You can either exclude or include one of the following dimensions.
1. ISP domain filter
Most people can easily retrieve their IP addresses, but have a lot of difficulty finding their ISP domain name.
ISP stands for Internet Service Provider. Your ISP domain can be found via this URL.
Be careful if you exlude an ISP domain. You might not only exclude your own visits, but those of other visitors as well.
That is why I advise to work with IP addresses or ranges if you want to filter out your own behaviour (recommended best practice).
2. IP addresses filter
Your IP address can also be found via the URL I shared in the last paragraph.
Let’s assume your IP address equals 67.173.191.105.
This is the filter you need:I hear you think, what should I do if I have a range of IP addresses?
This is when regular expressions come in handy.
Click on image to use the regex tool
I recommend to use a “custom filter” – something I will talk about soon – if you want to exclude an IP range.
Here you see an example of an IP addresses range filter in Google Analytics:3. Subdirectories filter
Let’s take a look at LunaMetrics.com (company specialized in the field of Analytics):
Their blog is one of the main parts of the website structure.
Following the link and a recently published blogpost reveals their website structure in more detail:
- http://www.lunametrics.com/blog/
- http://www.lunametrics.com/blog/2015/07/16/safely-migrating-to-google-tag-manager/
What does it tell you?
All their blogposts sit in the subdirectory /blog/.
It might be a good option to use an include filter on subdirectory to enhance the insights on their blog performance:
I have used “that begin with” here.
The reason why is that Google Analytics captures hostnames (domain name) but doesn’t display it in reports on default.
You could also use “that contain” here. For the sake of this tutorial I just want to be as accurately as possible.
Use your imagination to come up with great filters for your specific situation.
A last tip here is to check out Screaming Frog if you want to spider website structures in a quick way.
For less than $15 a month you can get a full SEO spider licence, which is definitely worth it!
4. Hostname filter
Your website hostname is often also called domain name.
However, it doesn’t include http(s)://.
My website hostname is online-metrics.com.
If your Google Analytics implementation only involves one domain, I recommend to set up an include filter on this domain.
This filter prevents others from hijacking your GA tracking code and placing it elsewhere. Normally this would affect your traffic stats.
Besides that it helps counter a large part of other SPAM traffic.
Three important things to remind:
- You should use only one include filter of the same type. For example, one include filter on medium=cpc and another include filter on medium=organic will result in no data being collected. Instead, you should use one include filter with a RegEx -> cpc|organic.
- Learn all about regular expressions in Google Analytics to become a Google Analytics filter pro.
- If you are using different filters for different purposes, you need to set up a new view for each of them and apply the filters accordingly.
2. Custom Filters
Custom filters in Google Analytics can be divided into four groups:
- Exclude/Include
- Lowercase/Uppercase
- Search and Replace
- Advanced
Exclude/Include filters
Here is an overview of all the current custom exclude/include filter combinations:
Click on image to download file
The possibilities are almost endless here! The main categories within this filter group are:
- Content and traffic
- Campaign or adgroup
- Ecommerce
- Audience/users
- Location
- Event
- Other
- Application
- Mobile device
- Social
Lowercase/Uppercase filters
Google Analytics reads lowercase and uppercase as two different characters.
This can cause data issues. Please review the following scenario:
- John tags an email campaign with utm_medium=Email.
- Peter tags an email campaign with utm_medium=email.
In this case Google Analytics would register two different media for the email campaigns. This can possibly ruin your data.
This is when lower- and uppercase filters come in handy.
I prefer to use lowercase filters over uppercase filters.
Here is an example:
Back to the scenario of John and Peter. This would fix any issues with capital letters, utm_medium would be “email” in both cases.
I recommend to set a lowercase filter on:
- Campaign Medium
- Campaign Source
- Campaign Name
- Campaign Term
- Campaign Content
- Request URI
Lower- and uppercase filters can be applied to all areas except location based filters.
Search and Replace filters
Search and replace filters can be really useful if you want to transform your data.
If another company is sending traffic with the wrong utm parameters, you can use a “search and replace filter” to correct the utm parameters before they are stored in your Google Analytics account.
Note:
Replace string is either a regular string or it can refer to group patterns in the search expression using backslash-escaped single digits like (\0 to \9).
If you want to have backslash(‘\’) in the replacement string you must use double backslashes (‘\\’) instead.
A common use case for the “search and replace filter” is to turn multiple URLs into one.
For example, to merge ‘example.com/article/running/10k.html’ and ‘example.com/article/swimming/100m.html’ so that your reports for the views for which you will apply this filter will show ‘example.com/article/’, please follow these steps:
The dot-asterisk (.*) means, take any random combination of zero or more characters.
In this case I want any characters behind /article/ to be removed from the URL.
Search and replace filters can be applied to all areas except location based filters.
Advanced filters
Advanced filters can be really daunting at first. Before trying to set them up I recommend to learn a lot about regex first.
In short, they allow you to combine fields into new variables.
A useful example is shown below:
Here I instruct Google Analytics to take the hostname and request URI and combine them together into the request URI.
On default, Google Analytics doesn’t show the hostname in the page report.
This filter allows the hostname to actually appear in the report.
A disadvantage of using this filter is that it breaks the links to your website in the content report, i.e. you won’t be able to click on a link that leads from Google Analytics to your website.
But, it can be very useful in a multiple domain implementation to apply this filter to your data. The choice is yours!
Advanced filters can be applied to all areas except location based filters.
Final notes:
- It looks like Google Analytics made a mistake by only including location based filters in the include and exclude filter group.
- The number of different Google Analytics filters are literally unlimited.
Filter Order
It’s important to know how view filters are processed, especially if you plan to use many different filters.
Filters are applied on the view level and you can set the filter order per view.
How to get to the “assign filter order” screen:
- Navigate to the admin overview screen
- Select the appropriate view
- Click on filters (under view)
- Click on “Assign Filter Order” (it’s next to red “new filter” button)
Here is an example:There are just a few options here:
- Move a filter up (so that it is processed earlier)
- Move a filter down (so that it is processed later)
- Save settings
Include and Exclude Filters
Include and exclude filters aren’t affected by filter order if you only use these filters.
I have mentioned before that you can’t include two include filters of the same type.
Please look at the examples below:
In the first example, Google Analytics won’t collect any data where the two filters are applied.
In the second example, where a regular expression is used, Google Analytics will only collect organic and cpc tagged media.
Keep in mind that if you use a Search and Replace, Lower/Uppercase, or Advanced filter to modify the URL or other field that you are using to include or exclude, those will be affected by filter order.
Example: How Filter Order Effects Data
Let’s assume you have set up the following filters:
Background
A company called Rainbowfilters has many external email campaigns running that are incorrectly tagged.
These campaigns show up in Google Analytics under a separate medium: e-mail instead of email.
That’s why they set up these filters to correct the issue.
What’s Wrong and How to Solve
The include filter is processed before campaign medium=e-mail is changed into campaign medium=email.
This causes the correctly tagged email campaigns not be measured in Google Analytics.
The fix is easy: simply place the Search and Replace filter before the current Include filter.
Make sure you understand how the processing part works before you go wild on Google Analytics view filters.
Filter Manager
You can manage your filters on two different levels:
Filter Management: Account Level
On the highest (account) level you can:
- Review all filters in your Google Analytics account
- Delete or modify filters
- Create new filters
- Add or remove already created filters in one or more views
Filter Management: View Level
On the lowest (view) level you can:
- Review all filters in your Google Analytics view
- Modify view filters
- Create new filters
- Add or remove already created filters in selected view
- Assign the filter order for this view
Bare in mind that you need edit rights at the account level to create new filters.
This is because new filters are stored at the account level.
Take a look at the ultimate guide to setting up your Google Analytics account if you want to learn more about the other settings as well.
Filters and Related Topics
Filters are related to many different reports and settings in Google Analytics.
In the following chapters I provide you with a broader view of filters and how they relate to other settings.
Filters and Site Search
Google Analytics allows you to measure your internal site search and this site search report can bring you tremendous insights.
It depends on your site structure whether you need filters or not to correctly measure site search behaviour in Google Analytics.
In some cases – if the site search query is not visible in the URL, you need to modify your implementation.
Google Tag Manager will be a great help if that’s the case. This is out of scope for this article.
I will describe two screnario’s here.
- http://www.example.com/search?q=filters (filters are not needed)
- http://www.example.com/index/search/filters (filters are needed)
First Scenario
In the first scenario the search term “filters” can be easily extracted from the URL.
It is connected to the query parameter “q”.
Just head over to the overall “view settings” and fill in the following:
You can tick the “strip query parameters” box if you don’t want the search term to appear in your content report.
Second Scenario
Like I mentioned in the introduction, sometimes filters are needed to process site search parameters in the correct way.
Let’s take another look at the URL:
- http://www.example.com/index/search/filters
Since there is no active query parameter in this URL, you need to set up a filter to send the site search data into Google Analytics.
These are the parameters you need:
- Field A -> Extract A: Request URI: ^/index/search/(.*)
- Output To -> Constructor: Search Term: $A1
- Select ‘Field A required’ and Override Output Field
After a couple of hours you will see the site search terms to appear in Google Analytics.
The same technique can be used to extract site search categories from the URL.
Filters and Real-Time
Already for quite some time, Google Analytics obeys your filters in the real-time reports:
In this particular data view you can see one page (the one I am visiting now).
I have only included my IP address here so visitors coming from other IP addresses are not registered.
It’s maybe not the best way to test your filter set up, but still it is great that real-time actually processes your filter set up.
So that your data in real-time will match your Google Analytics reports later on.
Filters and Sampling
I have already published a comprehensive guide on sampling in Google Analytics. Make sure to read that post as well!
No Sampling
In general there is no sampling problem if you are:
- Lucky to be a Google Analytics Premium User
- Only looking at aggregated reports without segmentation
- Running a website that doesn’t get ten thousands of visitors each day
Sampling Issue
You could have a data sampling problem if you are:
- Unlucky to not have access to Google Analytics Premium
- An advanced user who segments a lot to get more insights
- Running a website with loads of visitors and pageviews each month
In the example above you see that only 2,4% of the sessions are included in the sample.
Well, as you might guess, this data is far from accurate.
I always try to avoid sampling when doing data analysis.
Please aim for at least 80-90% sample rate if you want to draw any reliable conclusions from your data.
How Filters can Help
The standard reports are a great start, but sometimes you want to dig deeper in your reports.
Maybe you want to look at the page reports for just your affiliate visitors, and applying the affiliate medium advanced segment forces you into a sample.
- You can create a new view to just capture your affiliate traffic.
- Then put a filter on that view to only allow affiliate traffic.
- If you apply any segments in the view it will get sampled
- Standard reports will hold the unsampled data for just that affiliate traffic.
You can repeat this procedure to filter on region and set up several different data views.
It might be a solution for some of your sampling issues!
Besides that it is very handy if you want to give restricted access to some users.
Filters and Channel Groupings
Channel groupings are another way of looking at your traffic data/sources.
This instead of looking at the source/medium report:
One thing to remember here is shown below:
Click on image to read entire article
Filters Verification
Filters are not working…
Yeah, I have seen (too) many Google Analytics accounts where filters caused real data issues.
Follow these steps to minimize potential issues with your filters:
- Always keep a raw data (unfiltered) Google Analytics view.
- Educate yourself on regular expressions before trying out advanced filters.
- Don’t apply new filters to existing views without testing them first.
- Use testing views for the sole purpose of testing your new filters.
- Use the filter verification tool that is built-in in Google Analytics.
Filters Verification Tool
What you should know:
- Filter verification is based on a subset of your available data and may not be 100% accurate in all cases.
- Currently filter verification doesn’t work on advanced and location-based filters.
- Filter combinations cannot be processed.
- Adding a filter name is required to use the verification tool.
Example of Google Analytics filter verification:
I made a fictional filter to include only organic traffic.
As you can see, this filter would impact the collected data immensely.
You would only store organic traffic data from now on.
BONUS examples
I have already included many filter examples in this article.
There are three more filters I like to share with you.
- Remove all query parameters
- Remove slash (/) at end of URL
- Exclude internal traffic
1. Remove Query Parameters
In the Google Analytics view settings you can add one or more query parameters you like to filter out of your Google Analytics view.
But what if your website only contains technical query parameters you don’t need in your data analysis?
One option would be to separately filter them out of your Google Analytics view.
Another (maybe better) option would be to use a Google Analytics filter here:
This one will do the trick. After setting up this filter you will probably “lose” a lot of your fake unique URLs.
Please be very careful with using this filter.
You need to be 100% sure that the query parameters are not needed in your analysis.
2. Remove Trailing Slash (/) at End of URL
Very often URLs are accessible with and without a slash at the end.
For SEO purposes you need to set a canonical URL if one URL is not redirected to the other.
In Google Analytics you don’t want to see duplicate URLs here; that’s why you need to set up this filter:
3. Exclude Internal Traffic
This is not the most advanced filter to include, but it is of crucial importance.
Two factors that determine the importance:
- How much traffic do you get? (the less the bigger the influence on your data)
- How many pageviews do you, your colleagues, partners etc. generate? (the more the bigger the influence on your data)
As a best practice I recommend to filter out any IP addresses that contain artificial traffic.
Artificial traffic is traffic that impacts your numbers in an incorrect way.
Here is a fictional example on filtering out an IP address:
In the first chapters of this article I have already explained about how to filter an IP address range from your Google Analytics data.
Concluding Remarks
I hope you have learned a lot about Google Analytics filters after reading this guide.
Review these eight points before putting things in practice:
- Always keep an unfiltered data view.
- Always keep a profile with an include filter on internal IP addresses (for testing purposes).
- View filters belong to a long time segmentation strategy, are future based and cannot be undone.
- Segments are useful for ad hoc segmentation, are based on your current data and don’t impact stored data.
- Apply new filters to a secondary view first before adding them to your main view.
- Filters are useful to any type of website (lead generation, e-commerce, service, blogs etc.).
- New view filters don’t work directly; it can take up to 1 or 2 hours before they actually do their job.
- Don’t overlook filter processing order if you work with different (advanced) filters.
Is there anything you like to add? Please shine in with your experience on view filters.
One last thing... Make sure to get my automated Google Analytics 4 Audit Tool. It contains 30 key health checks on the GA4 Setup.
Cathy says
Thank you for this excellent post.
Paul Koks says
Thanks for your comment Cathy and I am glad you like the post!
Paul
Brett Cravaliat says
Peculiar article, exactly wha I was looking for.
Paul Koks says
Great to hear from you Brett, And I am glad this post is helpful for you.
Sangho says
Good article. Just wondering if you can help me with the ecommerce filter fields. Usually, if I want to check a certain value I run a report first to see if data comes up, but in the case of ecommerce filter fields the names are uncommon. Like ecommerce item name: I cannot run a report that contains ecommerce item name… It does not exist in the ecommerce reports. Also, when looking into the API I can only find item revenue, item quantity, items per purchase, but not item name.
Paul Koks says
Hi Sangho,
In Google Analytics you can filter on “Ecommerce Item Name”.
However, in the Google Analytics API you have a dimension named: “ga:productName”.
You can check this guide as well:
https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce
Please see subheading “add items’.
In Google Analytics under custom reports you can work with the dimension “Product”.
I haven’t used that exact filter field, but I think these terms refer to the same thing.
Hope this helps!
Paul
Jordan says
Great article and helpful in so many ways! I have several subdomains and we have one main analytics account tracking them together. Then we have 3 different views that filter traffic to only website1.com, only website2.com and only website3.com. I have set up tagged google campaign URLs linking to website3.com/buytickets. Set these up in URL builder and they work and are visible when I am looking at my unfiltered view, but the campaigns do not show up at all in my view for website3.com. The only filter i have on the view is “include only traffic from hostname containing website3.com.” What am I missing here? I would like to see those campaigns in my website3.com view. Any help would be appreciated!
Paul Koks says
I am glad you like the article!
I assume you have set up the tracking for all your subdomains correctly..
website1.com, website2.com and website3.com sounds like three different domains (not subdomains). Is that correct?
Your setup for website3.com should work. Just to make sure, you haven’t add an exclude filter on your IP? And there are no redirects involved?
It’s hard for me to really help since I can’t reproduce and test the campaign from here.
Liz says
I recently got a redundant hostnames error and one of the suggested fixes is to do a simple search-and-replace filter that strips “www.” from hostnames.. I presume I would just write http://www.domainname.com in the Search field and domainname.com in the Replace field. Why then am I seeing all these complicated posts on how to fix this error? Will the recommended GA edit not fix the problem? Am I completely missing the boat?
Liz says
The ‘http://’ was added by the Comment area editor function – sorry should have put it in quotes I guess.
Paul Koks says
Hi LIz,
Thank you for your comment.
You can use the “search and replace” function if you only want to see “domainname.com” in Google Analytics.
—–
Search and Replace
Hostname
^www\.domainname\.com$
^domainname\.com$
—–
As a second filter (make sure it comes after your first filter), I recommend to add an “Include” filter.
—–
Include
Hostname
^domainname\.com$
—–
This filter helps you to deal with *SPAM* traffic.
Besides that I recommend to have your www-version automatically redirect (301) to the non-www version of your website.
This post might be useful for you as well:
https://online-metrics.com/regular-expressions/
Let me know whether this solves your issue.
Thanks,
Paul
CV says
Hello,
Why do you recommend the following?
“Besides that I recommend to have your www-version automatically redirect (301) to the non-www version of your website.”
I’ve been tasked with doing the opposite for my job. What is your reasoning for having it the other way?
Paul Koks says
Hi,
I believe there are certain tools out there that can help you figure out the “strength” of a domain. That can help with your decision.
But in general, domains with www are more easy to use/brand, shorter and more popular.
Have you noticed that Chrome isn’t even showing the extension www in the Search Engines anymore?
Not a big thing, but just make sure you don’t have them both!
Best,
Paul
Diana says
Very good article, paul! Keep it up.
Here is my questions to you:
I have created a filter to display the full page path in my reports – Mainly to include the domain name (www.example.com). Now when creating a Goal funnel, do I need to include http://www.exmple.com/thank-you.html in the steps?
Let me know what you think.
Thanks
Diana
Paul Koks says
Thank you for your comment Diana!
The full page path will not include “http://”.
Let’s assume this is your URL:
http://www.example.com/thank-you.html
In this case you could do (if you use RegEx):
^www\.example\.com/thank-you\.html$ and include it as your goal URL.
You can verify your goals via the content reports or use “verify goal” directly in the goal settings. The last option only works if your account includes prior data that matches your goal.
Hope this helps!
Paul
Joan says
Hi. Did anyone try filtering a view in GA using a custom dimension? Example by using a specific product category custom dimension through data import?
Paul Koks says
Hi Joan,
Thank you for your comment. I haven’t tried it myself, but you might want to read this article:
http://www.lunametrics.com/blog/2015/10/16/filtering-session-user-custom-dimensions-google-analytics/
Best,
Paul
Apru says
Good article!
I think the main difference between filters and segments is filters get data from hit level and segments get data from sesion level. What do you think about that?
Paul Koks says
Thanks for your comment! You are right that filters work on the hit level and segments get data from sessions. Keep in mind that it is possible now to build segments on the user level as well. I recommend to read this article if you want to learn more about the differences between segments and filters. Best, Paul
Marius says
Hi,
First of all, great article.
Second I wanted to ask you something: if you have to filters of the same type you said it will not track properly. What can you do if you want to have more include filters, same type (Request URI)?
The reason we need more is because the regex is too long for only 1 filter and is not accepted by GA beyond 255 characters.
What is the solution is this case?
Thank you!
Paul Koks says
Thanks for your comment Marius. Two “exclude filters” of the same type won’t cause any problem, but two “include filters” won’t capture any data. This can be a challenge, but let me share my thoughts:
1) Try to find common patterns among the request URIs so that you can capture them all in one filter with the help of regular expressions (https://online-metrics.com/regular-expressions/)
2) If option 1 is not possible, you could try to use a few extra “search and replace” filters to rewrite your request URIs to a common theme. And after that capture them with one “include filter”. Make sure to get the filter order right (first “search and replace” and then “include”.)
Hope this helps!
Paul
Marius says
Thanks Paul.
I believe I’ll have to try the second one because the 1st one is not an option. I forgot to mention that the 255 char limit is exceeded using regex
Paul Koks says
Marius, the second option should work, but the amount of work depends on the request URIs that you need to capture. Best of luck!
Brandon says
1/ In the section Filters and Related Topics > Filters and Site Search > Second Scenario, will I retrieve only data/keywords after « ^/index/search/ » or the full URI?
=>Data will appear in report like « /index/search/filters » or « filters »
2/ In the section BONUS examples > 1. Remove Query Parameters, this bonus involves an incompatibility with the ability retrieving the internal search keywords. Can you confirm it?
3/ In the section BONUS examples > 2. Remove Trailing Slash (/) at End of URL, should I expect side effects? What about the homepage which finishing with ‘/’ ?
4/ I observe for a client that http://www.domain.com and domain.com are the same destination. Should I merge these two hostnames with filter search&replace? This will allow me to also merge metric.
Paul Koks says
Good questions Brandon!
First of all, always test your filters in a separate view first. Since Google Analytics is very quick in handling filters and incoming data, you can almost do this real-time (in many cases).
1) This will return only the search term query.
2) No, I don’t think this is an issue as I have handled many accounts dealing with this situation. Site search terms will always be processed first in this case. Make sure to test it!
3) No effect on home URL. You just have to know what you are doing when you apply these kind of filters. I recommend to learn more about this filter by working in a test view first.
4) Yes, you can merge both domains if you wish.
Example filter:
Search String: ^domain\.com$
Replace String: www . domain . com (without spaces of course)
Best,
Paul
Brandon says
Hi Paul,
Many thanks for your replies!
I will do the tests
best!
Brandon
Paul Koks says
Sure, you’re welcome! And let me know if you have any more questions. Testing filters will reveal most often all answers. Paul
Ben says
Hi Paul,
Does the remove all query parameters (.*?)\? method, mess with the UTM tracking params? Ie. do you campaign reports stop working?
Paul Koks says
Hi Ben,
Good question. No need to worry about that as the utm parameters are not stored in GA and your campaign tracking is not affected in any way.
Best,
Paul
Jackie says
Hi, great article. I’m new to Google Analytics and trying to figure it out. My company has site xyz.com, but we do digital publication on our server and they are under xyz.com/digital_media. Under digital_media, each company has their own folder and then their own magazines. I want to track and analyze the data for each magazine, so I’m trying to figure out the simplest way to do this. I have one account for my company, xyz and one property, http://www.xyz.com. Since there are only 25 views for each property, I really can’t put all the magazines issues under one property. Am I able to create a different property, xyz.com/digital_media and have both ID numbers on our site?
This is what it looks like:
Company xyz – 10000000
Xyz.com
Xyz.com/digital_media
Xyz.com/digital_media/companyA
Xyz.com/digital_media/companyA/Spring2017
Xyz.com/digital_media/companyA/Summer2017
Xyz.com/digital_media/companyB
Xyz.com/digital_media/company/Spring2017
Xyz.com/digital_media/company/Summer2017
Xyz.com/digital_media/companyC
Xyz.com/digital_media/companyC/Spring2017
Xyz.com/digital_media/companyC/Summer2017
How do I track the Spring and Summer magazines separately?
Thanks for any advice.
Jackie
Paul Koks says
Hi Jackie,
Thank you for reaching out! I already received the same comment on another blogpost, but here is my feedback.
First of all, tracking subdirectories in different views is usually a bad idea. You will have to deal with (not set) value dimensions when people navigate from one “company” directory to the other. In addition, it would be too much to get a view for each company.
In a sense they are already tracked separately, two URLs:
– Xyz.com/digital_media/companyA/Spring2017
– Xyz.com/digital_media/companyC/Spring2017
You can distinguish between them in one view based on /companyA/ vs /companyC/.
In this case and for this purpose I would work with one view. Of course you can set up other views for different purposes as explained on my site.
You can use landing page segmentation to see whether people go from one company directory to another in one session.
You can set up content grouping to group pages per company in a logical structure and see which pages are most popular, where people enter your site.
You can use page value to determine the correlation between digital media page consumption and goal conversions.
There are a ton of things you can do, without having to create additional views for this purpose.
Hope this helps!
Best,
Paul
Jackie says
Hi Paul,
Sorry about the double comment, I couldn’t find the other one. I appreciate you responding. My company, xyz.com publishes digital magazines for companies on our server, xyz.com/digital_media, but has our own site at xyz.com. Those who come to xyz.com can’t reach xyz.com/digital_media without a direct url link. Each company has their own library, so they would not be able to go to each others sites. Should I create a separate property for xyz.com and xyz.com/digital_media? I just need simple analytics for each companies magazine. There is so much information on setting up Analytics, it’s very overwhelming.
Thanks for your help,
Jackie
Paul Koks says
Hi Jackie,
This is too complex and there are too much unclarities for me to explain it in a short comment.
Do you want the companies to access their own data set or is this setup only beneficial for your own company?
You might want to send me a quick email (via the contact page) to discuss this further.
Thanks,
Paul
afshin says
You should use only one include filter of the same type
hi paul, I don’t understand this part above, can you explain this more?
Paul Koks says
Thanks for your comment. Sure, here is an example:
You have set up one view with an include filter on medium=cpc. If you would like to also include organic traffic in the same view, you can’t set up another filter with medium=organic. Instead you should change the current include filter in a RegEx -> cpc|organic. So no matter on which field you set an include filter, ALWAYS use one on the same field / of the same type.
I have slightly changed the post as well to further clarify.
Hope this helps! Paul
afshin says
thanks paul:)
Paul Koks says
Sure, you’re welcome! :-)
Prakadeeshwaran says
Its Realy Helpful for me to understand Everything .. Its Just Amazing Thanks Paul
Paul Koks says
Great to hear Prakadeeshwaran, and let me know if you have any questions! Best, Paul
Daniel McQuillen says
Thanks for the helpful article, Paul.
If you wanted to limit a View to just a set of custom events (no regular tracking data), my working assumption is that using an ‘include’ filter and setting the event category or action to something won’t work, because all non-custom-event data will still flow through.
Would you recommend some kind of configuration using “Advanced” to filter the view so only hits related to custom events of a certain type come through?
Thanks for any thoughts
Paul Koks says
Hi Daniel,
– True, you can limit what event data is collected in Google Analytics by using an “include” filter on an event dimension. However, like you mention, non-custom-event data will still come through. Tip: use a Test View to test a filter like this first and see how it works.
– What are you exactly trying to accomplish here? You could set up a custom report or drill-down to the dimension values that you need and then “save” (shortcut) it – for easy access later on. Or, you can leverage a tool like Supermetrics (connect to Google Sheets) or use Google Data Studio te create the data view you want. And correlate it to any dimension you like.
– The admin filters might not be your best solution here.
Hope this helps!
Best,
Paul
Terry says
Hi – your articles are so helpful. I’m hoping you can tell me how to create a filter for duplicate URLs in my GA reports. Some URLs do not have a trailing slash, and the other has “.aspx.” The vast majority of URLs in the reports end with “.aspx”
Example:
/home-decor and /home-decor.aspx
Thank you!
Paul Koks says
Hi Terry,
Thanks for reaching out!
1) Make sure to test any filters in a Test View first.
2) It sounds like you should start with cleaning up your URL structure first. Of course, you can do a lot with GA, but it’s even more important to clean up your website structure (SEO, usability etc.).
For the trailing slash, you can test this filter:
Filter Name: Add Trailing Slash
Filter Type: Custom filter > Advanced
Field A: Request URI
Extract A: ^(/[a-zA-Z0-9/_\-]*[^/])$
Output To: Request URI
Constructor: $A1/
For the .aspx I highly recommend to change your technical website structure to solve this duplicate URL issue. You don’t want to mix up these URLs on your site and find a sophisticated workaround in GA.
Best,
Paul
Terry says
Thank you, Paul – I appreciate your advice!
Paul Koks says
You’re welcome Terry and let me know if you have any other questions!
Chris McCreery says
Hey Paul,
In the example of the improper campaign tagging of e-mail and email
“These campaigns show up in Google Analytics under a separate medium: e-mail instead of email.”
Would you instead just edit your Channel grouping to add e-mail to the list? And if you created a new Custom Channel Grouping you could apply it to your historical data?
Thanks
Paul Koks says
Hi Chris,
Good point!
Yes, you could do that if you solely focus on analyzing and optimizing via Channel Groupings.
However, if you want the medium count to be accurate as well, you need to apply a filter or ensure that e-mail will be replaced to email at the “source” (campaign link itself).
Best,
Paul
manohar says
Hi Paul Is there any filters available in api using java
Paul Koks says
Hi Manohar,
Please read this article (don’t have experience with it myself):
https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference/management/filters/list
Best,
Paul
Matthew says
Hi Paul
Great article – thanks. We have a couple of domains which are served by the same physical site. The one is our main site, the second is a skinned version. Same UA account and script is used for both.
I have used a domain filter to include only traffic from the skinned domain. This gives us correct traffic reporting, but the Ecommerce data seems to include the conversion from the main domain? Is there a way to exclude it?
Paul Koks says
Hi Matthew,
I believe in this case filters won’t be the best solution. Filters and (enhanced) ecommerce don’t always go well together.
Is there a way to send the data to two different properties and to set up a roll up property to include traffic and conversions for both domain versions?
Best,
Paul
Deep says
Thanks Paul for this wonderful article.
Can you please tell me where can I practice sample Regex expressions as I’ve started to understand this hard nut in GA right after reading your ebook.
Paul Koks says
Hi Deep,
Thanks for the heads up! You can do many different things to test your RegEx knowledge, but one great place to start is the “All Pages” report in GA.
You can apply different regular expressions to try to match a particular set of pages. Further, you could also test your RegEx knowledge by setting up filters, but make sure to do it in a Test View first.
Hope this helps!
Best,
Paul
Roger says
Great article. Can you list the order of filters please?
If you list most common filters in the order, depending on what filters I or someone else uses, we know the order?
Thanks.
Paul Koks says
Hi Roger,
The order of filters depends on what filters you actually use. And it matters when filter A impact the working of filter B or vice versa.
Further, you can set up your own structure for filters usage and in what order you want them to appear.
Best,
Paul
Panos says
Hey Paul,
Great article!
I have a question similar to another comment here.
We have a client that we charge for referrals from our site on a PPC basis. And they want to have access to click statistics from our website.
All outbound clicks from our website are set up and tracked as events. So I thought that what they were asking for would be pretty straightforward by setting up a view for them where only traffic matching their referrals from our site could be included (through a Filter with Event action/label matching the events for outbound links to their site).
But I’m struggling with the right combo for this. What is the best Filter set up I can use to isolate these events only in a view?
Many thanks!
Paul Koks says
Hi Panos,
Personally, I never use these type of filters.
Two options that are much more suitable:
– Set up an automated Google Sheet that extracts the required data from GA (e.g. via Supermetrics).
– Set up a Google Data Studio dashboard where you simply show the information that your client needs. Could be done in a few minutes.
No mess up of your GA account and workable for all.
Hope this helps!
Paul
Marc says
Hi Paul,
Thanks for this post, very interesting!
I’ve been trying to work out how to exclude two versions of Firefox where I get a lot of direct bots coming to my site. I can’t find any articles covering this…
How would I create a filter to exclude the following two browser versions in Firefox:
45.0.247 & 63.0?
Many thanks,
Marc
Paul Koks says
Hi Marc,
I think an exclude on the regular expression below will work:
^45\.0\.247$|^63\.0$
Use “Browser Version” in the filter field.
Also, use a segment instead if you want to apply this retroactively on your data.
Best,
Paul
Marc says
Hi Paul,
Thanks a million for your help.
Marc
Paul Koks says
Sure, happy to help Marc!