Share
Contents
One common issue that GA4 users face is the inclusion of URL query parameters in their reports, which can distort the data and make it challenging to analyze. This article will detail how to exclude URL query parameters from GA4 reports, including landing pages, URLs, and more. By following these simple steps, you can ensure that your data is accurate and actionable, allowing you to make informed decisions based on reliable information. Let’s get started.
Why you should remove URL Query Parameters in GA4
You should remove URL query parameters in GA4 for several reasons, and we will look at the key reasons below.
- Data Accuracy: URL query parameters can fragment website pages and create multiple variations of the same page in GA4 reports. This fragmentation makes it challenging to measure page performance accurately and can lead to skewed data analysis.
- High Cardinality Issues: For Standard Google Analytics users, the inclusion of query parameters can result in high cardinality problems, where pages are grouped into “(other)” due to the multitude of variations. This can obscure valuable insights and hinder practical data interpretation.
- Compliance with Google’s Privacy Terms of Service: Personally identifiable information (PII) can be collected via query parameters, which goes against Google’s privacy terms of service. Removing query parameters is not just a best practice, it’s a necessity to mitigate the risk of inadvertently collecting sensitive user data and ensures compliance with data privacy regulations, a risk that you can’t afford to take.
- Streamlined Reporting: Excluding query parameters from GA4 reports can streamline data analysis processes, making tracking and measuring website performance easier. This simplification enhances reporting efficiency and enables more effective decision-making based on reliable data.
- Enhanced Data Security: By removing URL query parameters, you not only reduce the risk of exposing sensitive information but also enhance data security within your GA4 account. This proactive measure is a crucial step in safeguarding user privacy and protecting against potential data breaches, providing a sense of security for you and your users.
In conclusion, removing URL query parameters in GA4 is essential for maintaining data accuracy, complying with privacy terms of service, and optimizing data analysis processes. By taking this proactive step, you can ensure that your analytics data is reliable, secure, and aligned with best practices in digital data management.
Why GA4 Redact Feature is not enough
The redact feature in Google Analytics 4 (GA4) is a powerful tool that allows users to hide or remove URL query parameters. However, it’s crucial to understand that this functionality may not comprehensively address all URL query parameters, which is a key aspect to consider for accurate data analysis.
Firstly, the redact feature in GA4 is currently limited to web data streams, excluding other data streams like apps or offline sources. This restriction significantly narrows the scope of the redact feature for removing URL query parameters.
Additionally, the redact feature in GA4 has constraints on the precision of redaction, potentially leaving some URL query parameters needing to be addressed. For example, consider a scenario where you have a landing page for a marketing campaign with different tracking parameters appended to the URL: example.com/about-page, example.com/about-page?twclid=uxfygt, and example.com/about-page?tg124i=false.
Suppose you use GA4 data redact feature to redact “twclid” and “tg124i” parameters. In that case, your report will still show three distinct URLs in your analytics data- example.com/about-page, example.com/about-page?twclid=(redacted), and example.com/about-page?tg124i=(redacted). This can lead to data clutter and make it challenging to analyze the landing page’s performance accurately.
Furthermore, the redact feature does not extend to data imported into GA4, which means GA4 users can import some URL query parameters alongside other data. This further risks the privacy of imported data by allowing some URL query parameters to be imported.
How to determine the URL Query Strings to delete
In order to determine which URL query strings to delete, you should review the URL query parameters collected in your GA4 data. You can identify them by creating an exploration report. Go to the explore section in your admin page’s left-hand menu and select “Create a new exploration.” Then, add the “Page path + query string” as a dimension and “Event count” as a metric in the report. To view only page URLs that contain query parameters, add a filter “Page path + query string” contains “?” and click “Apply.” This will allow you to see the URL query parameters collected by your property. Look for parameters that do not contribute to your analysis, are unnecessary, or contain sensitive or personally identifiable information. These ones should be deleted.

Popular query parameters you might want to exclude
These are popular query parameters that you may want to consider excluding from your data analysis to improve data accuracy and to protect sensitive information.
Query Parameter | Description |
fbclid | Facebook Ads Click Identifier |
msclkid | Microsoft Click ID parameter |
twclid | Twitter Click ID parameter |
mc_cid | Mailchimp campaign ID parameter |
mc_eid | Mailchimp email ID parameter |
ml_subscriber | MailerLite subscriber parameter |
omnisendContactID | Omnisend contact ID parameter |
s_cid | Adobe tracking parameter |
gtm_debug | Google Tag Manager debug parameter |
__hssc | HubSpot session start counter parameter |
__hsfp | HubSpot form submission parameter |
_hsenc | HubSpot encrypted parameter |
_ke | Klaviyo tracking parameter |
hsCtaTracking | HubSpot Call-to-Action tracking parameter |
igshid | Instagram shared post identifier |
cc_number | Credit card number |
How to exclude URL Query parameters from the URL using Google Tag Manager
To exclude URL Query parameters from the URL using Google Tag Manager, please follow the steps below:
Time needed: 15 minutes
- Add Custom Template to your GTM account
To begin, integrate a custom template into your Google Tag Manager (GTM) account to streamline the process of excluding URL query parameters. Access your GTM web container’s interface and navigate to the Templates section. Click on “Search Gallery” within the Variable Templates category and locate the “Trim Query” template developed by Ayudante. This template will provide a tailored solution for effectively managing and removing unwanted query parameters from your URLs.
- Create a variable to exclude URL Query parameters
Create a dedicated variable in Google Tag Manager (GTM) to exclude specific URL query parameters using the previously added “Trim Query” template. To set up this variable, navigate to Variables > New > Variable configuration in GTM and choose “Trim Query” as the variable type. Select Page URL as the Target URL for this variable, as it will focus on the page’s URL. Next, list the query parameters that you want to exclude.
- Update GA4 configuration tag
Update the GA4 configuration tag to incorporate the variable created in the previous step. By integrating this variable, you can exclude specific URL query parameters from being sent to GA4 for tracking and analysis. Within your GA4 configuration tag settings, include a new parameter called page_location and assign the custom variable established earlier as its value. This modification ensures that only the refined and relevant data, excluding the specified query parameters, is transmitted to GA4, enabling more accurate and focused analytics insights.
- Test your implementation using GA4 DebugView
Before publishing your Google Tag Manager (GTM) container, it is crucial to test your implementation using GA4 DebugView. This tool helps you verify that excluded URL query parameters are not being captured in Google Analytics 4 (GA4) and ensures that your setup is effective.
When you’re in Preview mode, it’s time to enter your website’s URL. But here’s the trick: You need to include the excluded query parameters, and they should be separated by “&.” For example, I will use “vakulski-group.com?twclid=12345&first_name=josh.” Once you’ve got that, hit Connect.
Next, go to Google Analytics > Admin > DebugView to locate your device, review the most recent events, and confirm that the page_location values do not contain the excluded parameters as intended. This testing process helps validate the accuracy and functionality of your exclusion settings before deploying them live.
As shown in the image, the query parameters were successfully excluded from the data collected in GA4. - Publish the GTM container
How to exclude URL Query parameters for GTAG
To effectively exclude URL query parameters for GTAG, you can take the following steps:
- Identify Query Parameters: Identify the URL query parameters you wish to exclude from tracking in GTAG. This may involve pinpointing parameters containing sensitive information or not aligning with your tracking objectives. As discussed in previous sections, you can identify the URL query parameters to exclude using G4 Explore.
- Collaborate with Your Developer: Work closely with your developer to implement the necessary changes. Your developer must write custom code that excludes unwanted URL parameters while sending the page_location parameter in the gtag code.
- Maintain a List of Excluded Parameters: Your role involves preparing and maintaining a list of unwanted parameters that the developer should exclude from tracking. This list serves as a reference to ensure that only relevant data is captured in GTAG. This is not a one-time task; as you identify new parameters, it may require updates in the future. Any changes or additions to the list should be promptly incorporated into the code to maintain accurate tracking practices.
By diligently following these steps and fostering a strong, open line of communication with your developer, you can effectively streamline the process of excluding unwanted URL query parameters in GTAG. This approach ensures that your tracking efforts are in perfect alignment with your data privacy and tracking goals.
Do you need extra help with your Google Analytics?
GA4 offers a range of features and capabilities that enable businesses to gain valuable insights into their website or app performance and user behavior. By utilizing GA4, you can effectively track and analyze data, make data-driven decisions, and optimize your online presence. At Vakulski-Group, we specialize in providing comprehensive assistance with GA4, ensuring you can fully utilize this powerful analytics tool. Our services include GA4 implementation, customization, and data analysis. By partnering with us, you can leverage the full potential of GA4 and make informed decisions for your business. Contact us today to get started on maximizing the benefits of GA4!






Final Words on How To Exclude URL Query Parameters in GA4
In conclusion, excluding URL query parameters in Google Analytics 4 (GA4) is crucial for refining data analysis and ensuring the accuracy of insights. By strategically removing irrelevant or sensitive query parameters, you can streamline your data, enhance the precision of your reports, protect user privacy, and maintain data consistency across platforms. Leveraging tools such as Google Tag Manager, GTAG, and GA4 DebugView can significantly assist in effectively implementing and testing the exclusion of these parameters. Regularly monitoring your data collection and fine-tuning your tracking setup is essential to guarantee that the excluded parameters remain omitted from your analytics data. By following these best practices diligently, you can optimize your data analysis efforts in GA4, enabling you to make informed decisions based on reliable and relevant data.
Frequently Asked Questions
To exclude URL query parameters in GA4 using GTM, add the “Trim Query” custom template from the GTM Template Gallery, create a dedicated variable with this template to exclude specific query parameters, and update the GA4 configuration tag to include a new parameter called page_location that uses this custom variable.
To view landing pages without query strings in Google Analytics 4 (GA4), you can access the Landing Pages standard report by navigating to the Engagement section in the GA4 interface. Alternatively, you can create an Exploration report using the “Page Path” and “Screen Class” dimensions along with any metric of your choice. Utilizing these features allows you to analyze landing pages specifically without query strings, gaining insights into user behavior and engagement on your website’s entry points.
You Might Also Like

Written By
Ihar Vakulski
With over 8 years of experience working with SaaS, iGaming, and eCommerce companies, Ihar shares expert insights on building and scaling businesses for sustainable growth and success.
KEEP LEARNING
Are you curious about how many visitors are leaving your website through outbound links? Tracking outbound links in Google Analytics 4 can provide valuable insights…
Google Analytics is a popular choice for tracking and analyzing user behavior. While Google Analytics provides a wealth of data, extracting and exporting this information…
Leave a Comment
Your email address will not be published. Required fields are marked *
Stay Updated About Every New GA4 Feature
Subscribe to this newsletter to learn more about new Google Analytics 4 features and adjustments.
No SPAM and only relevant content guaranteed!