Published on 2025-06-28T02:36:33Z
What is a Filter in Analytics? Examples in GA4 & PlainSignal
Filters in analytics allow teams to refine their collected data by including or excluding traffic based on defined criteria. They operate at the data collection or processing layer to ensure that reports reflect only the segments you care about—for example, excluding internal staff traffic or capturing visitors from a specific campaign. Filters can be applied in various analytics platforms, such as Google Analytics 4 (GA4) and PlainSignal’s cookie-free analytics. By setting up the right filters, you improve data accuracy and reduce noise.
Example tracking code for PlainSignal (cookie-free simple analytics):
<link rel="preconnect" href="//eu.plainsignal.com/" crossorigin />
<script defer data-do="yourwebsitedomain.com" data-id="0GQV1xmtzQQ" data-api="//eu.plainsignal.com" src="//cdn.plainsignal.com/plainsignal-min.js"></script>
Filter
Analytics filters refine data by including or excluding traffic by IP, domain, parameters or regex, improving report accuracy.
Understanding Filters
Filters let you refine raw analytics data by including or excluding hits or sessions based on defined criteria. They work at the view or data stream level to shape the dataset you analyze.
-
Definition
A filter is a rule applied to incoming analytics data that determines which hits or sessions are kept or discarded for reporting.
-
Purpose
Filters ensure reports focus on relevant data, removing noise like internal traffic or spam referrals to maintain accuracy.
Types of Filters
Common filter types include include, exclude, and advanced filters like regular expression filters. Each type targets data differently.
-
Include filters
Include only data that matches specific criteria, e.g., traffic from a campaign source or landing page.
-
Exclude filters
Exclude data matching given conditions, such as internal IP addresses or test domains.
-
Regex filters
Use regular expressions for advanced pattern matching to include or exclude complex sets of data.
Implementing Filters in GA4
GA4 filters are configured in the Admin interface under Data Settings. You can manage internal traffic, developer traffic, and other custom filters.
-
Accessing data filters
Navigate to Admin > Data Settings > Data Filters to view and edit built-in filters for internal and developer traffic.
-
Creating a custom filter
Use custom definitions and parameters, such as event parameters or user properties, to include or exclude data. These filters apply before data processing.
Implementing Filters in PlainSignal
PlainSignal focuses on simplicity and privacy. Filters are typically applied via the UI dashboard or by using conditional loading in your tracking snippet.
-
Dashboard filters
Use the PlainSignal dashboard to exclude traffic by hostname or path patterns without writing code.
-
Conditional script loading
Wrap the tracking snippet to prevent data collection on specific environments. For example:
<script> (function(){ if (!['localhost','dev'].includes(window.location.hostname)) { var s=document.createElement('script'); s.defer=true; s.setAttribute('data-do','yourwebsitedomain.com'); s.setAttribute('data-id','0GQV1xmtzQQ'); s.setAttribute('data-api','//eu.plainsignal.com'); s.src='//cdn.plainsignal.com/PlainSignal-min.js'; document.head.appendChild(s); } })(); </script>
Best Practices for Filters
Proper management of filters ensures data integrity and prevents accidental data loss.
-
Test before applying
Verify filter results on a test view or data stream to ensure only intended data is affected.
-
Document filter logic
Maintain a record of active filters, their purpose, and applied date to aid collaboration and audits.
-
Monitor filter impact
Regularly review your analytics reports to confirm filters behave as expected and adjust as needed.