How to Add Filters in Google Analytics

Cody Schneider

Cleaning up your Google Analytics data with filters is one of the fastest ways to get more accurate, trustworthy insights. By removing irrelevant traffic - like your own team’s visits or spam from bots - you get a much clearer picture of how real customers are actually interacting with your site. This guide will walk you through exactly how to set up and use filters in both Google Analytics 4 and Universal Analytics.

What Are Google Analytics Filters and Why Bother Using Them?

In Google Analytics, a filter is a rule that modifies the data in your reports. You can use filters to include, exclude, or change data based on specific criteria you set. Think of it as a sieve for your website traffic, it helps you screen out the noise so you’re left with only the most valuable information.

So, why is this important?

  • Improved Data Accuracy: The most common use for filters is to exclude internal traffic. Every time you, your employees, or your web developers visit your website, Google Analytics counts it as a visit. These sessions can skew your metrics, making your traffic look higher and your conversion rates lower than they really are. A simple filter can remove this internal data for a more accurate view of genuine customer behavior.

  • Focused Reporting: Let's say your business operates in the US and Canada, but you get a lot of random traffic from other countries. You can create a filter to include only traffic from your target countries, giving your marketing team a laser-focused report on the audience that matters most.

  • Cleaner Data and Better Organization: Filters can also clean up messy data. For example, people might find your site through URLs with different casing (e.g., /Blog vs. /blog). A "force to lowercase" filter ensures all URL data is standardized, preventing you from having duplicate entries for the same page in your reports.

Without filters, you're making decisions based on diluted, and sometimes misleading, data. By taking a few minutes to set them up, you ensure your reports reflect reality, leading to smarter marketing strategies and better business decisions.

Key Difference: Filters in Universal Analytics vs. GA4

Before jumping into the "how-to," it's essential to understand that filters work very differently in Google Analytics 4 compared to the older Universal Analytics (UA). This is a common point of confusion for many users.

In Universal Analytics, filters were applied at the "View" level. You could have a "Raw Data" view with no filters, a "Master View" with filters to exclude internal traffic, and perhaps a "Test View" for trying out new filters. The critical thing to remember is that UA filters are destructive. Once applied to a view, they permanently change the data from that point forward. There is no way to get the filtered-out data back in that specific view.

Google Analytics 4 has a completely different structure. There are no "Views" in GA4. Instead, we have two main ways to filter data:

  1. Data Filters: These are applied at the Property level and are a bit like UA filters. They are primarily used to exclude internal and developer traffic. Once activated, they also permanently affect your data going forward.

  2. Report Filters and Comparisons: This is the more common, flexible way to filter in GA4. These filters are applied directly within your reports (especially in the "Explore" section). They are non-destructive, meaning they only change the data you’re looking at for that specific report, at that moment. You can add, remove, and change them as much as you like without affecting the underlying raw data.

With that context, let's walk through how to set up filters in both platforms, starting with the current standard, GA4.

How to Add Filters in Google Analytics 4

As mentioned, filtering in GA4 is a two-part story. We'll cover property-level data filters first, then the much more flexible report filters.

1. Setting Up Data Filters (Internal & Developer Traffic)

This is the method you'll use to permanently exclude traffic from your reports, which is perfect for filtering out your own company's activity. The process involves three main steps: defining your IP addresses, creating the filter, and then activating it.

Step 1: Define Your Internal Traffic

  • Navigate to the Admin section by clicking the gear icon in the bottom-left corner.

  • Under the "Property" column, select Data Streams and click on your website's data stream.

  • Scroll down and click on Configure tag settings.

  • Under "Settings," click Show more if needed, and then select Define internal traffic.

  • Click the Create button.

  • Give your rule a descriptive name, like "Main Office IP Address."

  • Keep the default traffic_type value as "internal." This is the flag GA4 will use to identify this traffic.

  • Under "IP addresses," choose a "Match type" (e.g., "IP address equals") and enter your public IP address. To find yours, you can simply Google "what is my IP address."

  • If you have multiple office locations or remote-team members to exclude, you can add more IP addresses by clicking Add condition.

  • Click Create in the top right to save your internal traffic rule.

Step 2: Create the Data Filter

  • By default, GA4's internal traffic filter is in "Testing" mode. This means it adds a dimension called traffic_type to your data, allowing you to check if it's working properly before you permanently exclude the data. After you've verified it, you need to set the filter to "Active."

  • Go back to Admin.

  • Under the "Property" column, go to Data Settings > Data Filters. You will see the "Internal Traffic" filter with a "Testing" status.

  • Click the three dots on the far right of that filter and select Activate filter from the dropdown menu.

  • A confirmation pop-up will appear warning you that this action is permanent and cannot be undone. Click Activate to proceed.

That's it! From this point forward, GA4 will permanently exclude all traffic matching the IP addresses you defined. The filter status will change from "Testing" to "Active."

2. Using Report Filters & Comparisons

This is where you'll spend most of your time filtering in GA4 for day-to-day analysis. These filters are non-destructive and incredibly powerful for drilling down into your data within your reporting interface.

Using Comparisons in Standard Reports:

  • Most standard reports (like the Traffic Acquisition report) have a simple filtering option at the top called "Add comparison."

  • At the top of your report, click + Add comparison.

  • Build your condition on the right panel. For example, to see only traffic from the United States, you would select the dimension "Country," the match type "exactly matches," and the value "United States."

  • Click Apply.

  • GA4 will now show you the data for your selected segment side-by-side with "All Users." You can remove the "All Users" segment by hovering over it and clicking the "x" to focus solely on your data slice.

Using Filters in Exploration Reports:

  • The "Explore" section is where you can build custom reports from scratch, and its filtering capabilities are much more robust.

  • Let's say you want to see which landing pages drive the most engagement from organic traffic in Canada.

  • From the left-hand navigation, click Explore and start a "Blank" new exploration.

  • Add Dimensions: In the "Variables" column on the left, click the "+" next to "Dimensions." Search for and import "Landing page + query string," "Session source / medium," and "Country."

  • Add Metrics: Click the "+" next to "Metrics." Search for and import "Sessions," "Engaged sessions," and "Engagement rate."

  • Build the Report: Drag your "Landing page..." dimension to the "Rows" area in the "Tab Settings" column. Drag your metrics ("Sessions," etc.) to the "Values" area. You'll now see a table of all landing pages and their engagement metrics.

  • Apply Filters: Now, let's filter this down. In the "Tab Settings" column, scroll down to the "Filters" section.

    • Drag the "Session source / medium" dimension into the filter box. Select "contains" as the match type and enter "google / organic". Click Apply.

    • Drag the "Country" dimension into the filter box. Select "exactly matches" as the match type and enter "Canada". Click Apply.

Your table will now update to show you only traffic from Google organic search in Canada, revealing exactly which landing pages are performing best for that specific segment. You can change or remove these filters at any time without impacting your raw data.

Best Practices for Using GA Filters

  • Be Careful with Permanent Filters: For GA4 "Data Filters" (and all UA filters), remember that they are permanent. There is no undo button. Always double-check your IP addresses and settings before activating them. This can't be stressed enough.

  • Use Descriptive Names: Whether it's a permanent Data Filter or a saved Exploration, use clear names. "Exclude Office IP v2" is much better than "Test Filter 1." This helps you and your teammates understand what a filter does at a glance.

  • Document Your Changes: When you add an important permanent filter, make a note of it. Google Analytics has an "Annotations" feature (in UA) and for GA4, you can use "Change History" in the Admin panel to keep track of changes. A simple shared document can also work wonders.

  • Regularly Review Your Filters: Office locations can change, IP addresses may be updated, and your reporting needs might evolve. Set a reminder to audit your filters every 6-12 months to make sure they are still correct and relevant.

A Quick Note on Universal Analytics Filters

While UA is being phased out, you might still need to edit filters on an old property or understand how they were configured. The process was quite different.

To add a filter in UA:

  1. Navigate to Admin → View → Filters.

  2. Click + Add Filter.

  3. Give your filter a name and choose the filter type:

    • Predefined: This offered templates for the most common filters, like excluding traffic from an IP address or a specific domain.

    • Custom: This allowed you to build filters based on almost any dimension in GA (like Country, Campaign Source, Hostname, etc.), often using more complex rules or regular expressions.

  4. Configure your filter details and click Save.

The number one rule in UA was to never apply filters to your main "All Website Data" view. You would first create a copy of that view, name it something like "Master View" or "Filtered View," and apply your filters there. This preserved your original raw data in case of any mistakes.

Final Thoughts

Setting up filters in Google Analytics is a foundational step for anyone serious about making data-driven decisions. Whether you're applying permanent filters in GA4 to clean up your data for good or using temporary report filters to explore a specific user segment, it brings you much closer to actionable, reliable insights.

All this work - setting up filters, cleaning data, and triple-checking settings - is done to ask better questions and get clear answers about our marketing and sales performance. We built Graphed because we believe getting those answers shouldn't require so much tedious setup. After a one-click connection to your Google Analytics account, you can simply ask questions in plain English like, "show me traffic from Canada by landing page last month" or "which campaigns had the highest engagement rate?" and get the visualization built for you instantly, without ever needing to manually build a filter yourself.