Author

Analytics Expert. Passionate about SEO and User Experience or what he calls UX-SEO

Follow me on

2 ways of veryfying your filters in Google Analytics.

Filters in Google Analytics are an excellent way of organizing the data in your views and blocking spam and other junk traffic, but they can also be a problem if they are incorrectly configured.

Filters effects are permanent, and data lost by a wrongly set filter can't be recovered, so it is important to make sure your filter is ok before you apply it.

Why is important to verify your filter in Google Analytics?

Verifying your filters will let you preview the effects of a filter on incoming traffic before the filter is applied and active.

Benefits of verifying:

  • Filter verification lets you see the possible effects of your filter live. It takes time (as much as 24 hours) before filter effects become visible in your data, so you won't know instantly if the filter is working as desired.
  • Filter effects are permanent: filtered data cannot be restored to its original, unfiltered state. Filter verification can help you catch errors or problems before you save the filter and possibly impact real data in undesirable ways.
  • Filter verification makes trying out variations of your filters much more convenient.

In summary, it will save you time and protect your data by making sure your filters are correctly configured before going live when applying them to the view.

Verify your filter in Google Analytics

There are two ways of verifying your filters:

  1. Built-in Verification tool; fast but inaccurate in some cases.
  2. Using a quick Segment; takes more time to prepare, but it's a lot more accurate.

1. Built-in Verification tool

This built-in feature will allow you to test your filters quickly, but it has some limitations:

  • Filter verification uses only a small sample of your data.
  • You cannot verify filters for IPs or Geo-based fields.
  • You cannot test advanced filters.

How to verify a filter with the built-in feature

To verify a filter in Google Analytics using the built-in feature:

  1. Create a filter at a View level (Creating it the account level won't work)
  2. Configure your filter
  3. Click Verify this filter almost at the bottom of the window.
    Google Analytics filter verification
  4. Analyze the “Before” and “After” (you can check some tips below to understand the preview table)
    facebook filter verification 1 GA

Understanding the filter verification table

  • Only data that will be affected by the filter (and is contained in the sample) will be shown in the table.
  • The left side of the table shows the rows that would be excluded from your reports after the filter starts working.
  • The right side of the preview table shows data that will be included again only if it was excluded previously.
  • For Include Filter: the rows on the left side will show records that don't match your filter parameters.
  • For Exclude Filter: the left side will show the records that match your filter parameters.

Error: "This filter would not have changed your data"

This is a common issue, especially when creating filters for data that is not regular like filters to clean up the Spam in Google Analytics. When the filter verification can't find a match in the sample data, it will return the following message.

This filter would not have changed your data. Either the filter configuration is incorrect, or the set of sampled data is too small.

This filter would not have changed your data. Either the filter configuration is incorrect, or the set of sampled data is too small.

That doesn't necessarily mean that your filter is incorrectly configured. There are three possible reasons for this to happen:

Why are you getting the message: "This filter would not have changed your data"

  1. Incorrect filter configuration: Maybe you made a mistake defining the filter. Check your filter pattern for misplaced or extra characters or spaces. You can use any of these online free tools to check your regular expressions: regex101 or regexr
  2. The Filter is already saved: If you save the filter and then try to verify it, Google Analytics will consider that there is already a filter saved with the same configuration so this "new filter or version" won't change anything. If you want to verify the filter, you will have to delete it first and then try again.
  3. There is no match in the Sample Data: If you ruled out the other 2, then it just means that the filter verification tool didn't find any match in the sample data. If this is the case, you should use the second method to verify your filter Quick Segment.

2. Verify the filter using a quick Segment

When the built-in filter verification is not enough, you can use a quick segment to verify your filter. It takes a little more time, but a sampled data won't limit you.

Segments are similar to filters; the difference is that segments are not permanent, and they can be applied retrospectively to any date range.

We will use the box a the top of any of the Google Analytics reports.

How to test a filter with a quick segment?

To test a filter in Google Analytics using a quick segment:

  1. Go to the corresponding report (if your filter is for referrals[campaign source] go to the referral report, hostnames go to the hostname report and so on)
  2. Once you are in the correct report, click on the blue text that says advanced (top of the report next to a search box)
  3. Configure the segment and click Apply
    • 1st dropdown: Whether you are including or excluding in the filter select Include.
    • 2nd dropdown: Leave it as it is
    • 3rd dropdown: Select Matching RegExp
    • Text box: Enter the expression you want to verify
    how-to-verify-your-filter-in-google-analytics
  4. Click Apply. Now the report below should show all the entries you added to the expression only. If you see more or fewer entries than you want then check for typos, extra characters or extra spaces. TIP: a common mistake is leaving a pipe | at the end of the expression.
  5. [Optional] If your filter is complex and you want to make sure that you don't forget any entry, click again on the blue text advanced and select Exclude this time without changing anything else. Now go to the report and make sure that you didn't forget any entry.
  6. Once you are happy with the results go and create your filter.

A simple example

I'll use this example with both verifying methods.

Let's say I want to create a filter to exclude all the data coming from the Desktop version of Facebook. While this can be done in different ways, I will use the Facebook referral identifiers:

DESKTOP MOBILE
facebook.com m.facebook.com
l.facebook.com lm.facebook.com

Note: Facebook sometimes adds a letter "l" shows like l.facebook.com this is some kind of protection for the privacy of the users.

The first version of the exclude filter (Facebook Desktop) will look like this:

Note: The pipe character | means OR in REGEX

Admin in GA > Select a View > New Filter > Select Custom Filter > Campaign Souce.

Example with Method 1: Testing the filter with the built-in feature

After clicking on verify this filter, with the first expressionfacebook.com|l.facebook.com, we see in the preview table that all the facebook referrals will be filtered not only the desktop ones.

facebook filter verification 1 GA

With this configuration, I will exclude everything not just the Desktop version; this is because custom filters work with regex so everything matching the expression:

To fix it, we have to adjust the filter pattern like this ^facebook.com|^l.facebook.com (The character ^ means "begin with" in REGEX)

facebook desktop pattern GA

After changing the regex and verifying again, we get the desired result.

facebook filter verification 2 GA

Now that I verified that the filter would work as expected, I can apply the filter safely.

Example with Method 2: Testing the filter with a quick segment

Following the quick segment verification with the Facebook example (we want to exclude Facebook referrals from desktops/laptops so the ones without an m)

1. We go to the report Referral (Source) report

verify-filter-with-segment-full-table

Note: the facebook referrals with the letter "L" at the beginning are not visible in the screenshot because they are below in the report.

2. Test the expression.

  • The First expression facebook.com|l.facebook.com (The pipe character | means OR in REGEX)
filter-verification-example-not-ok
verify-filter-with-segment-wrong

When we check the report we see also the referrals for Mobile so the expression is not ok.

  • The Second expression ^facebook.com|^l.facebook.com (the character ^ means begin with in Regular Expressions)
filter-verification-example-ok
verify-filter-with-segment-right

After fixing the expression the verification shows only the desktop version so the filter will work as expected

Conclusion

By verifying your filters, you will have the security that you aren't losing any valuable data. For a quick test use the built-in feature "Filter verification".

If you are getting the message "This filter would not have changed your data", there is a big chance that the sample data used by the tool is not enough. In that case, use the second method, quick segment, to verify your filter.

Author

Analytics Expert. Passionate about SEO and User Experience or what he calls UX-SEO

Follow me on
Be the first to comment :)