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. 

URL Query Parameters in GA4 Exploration Report
URL Query Parameters in GA4 Exploration Report

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 ParameterDescription
fbclidFacebook Ads Click Identifier
msclkidMicrosoft Click ID parameter
twclidTwitter Click ID parameter
mc_cidMailchimp campaign ID parameter
mc_eidMailchimp email ID parameter
ml_subscriberMailerLite subscriber parameter
omnisendContactIDOmnisend contact ID parameter
s_cidAdobe tracking parameter
gtm_debugGoogle Tag Manager debug parameter
__hsscHubSpot session start counter parameter
__hsfpHubSpot form submission parameter
_hsencHubSpot encrypted parameter
_keKlaviyo tracking parameter
hsCtaTrackingHubSpot Call-to-Action tracking parameter
igshidInstagram shared post identifier
cc_numberCredit 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

  1. 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.
    Install Trim Query Template

  2. 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. 

    GTM Variable to Exclude URL Query Parameters

  3. 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.
    Updated GA4 Configuration Tag to Exclude URL Query Parameters

  4. 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.
    GA4 DebugView for Testing URL Query Removal Setup

  5. Publish the GTM container

    Publishing-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

How to exclude URL Query parameters in GA4?

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.

How to see landing pages without query strings in GA4?

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.

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

Leave a comment

Your email address will not be published. Required fields are marked *

Leave a Comment

Your email address will not be published. Required fields are marked *

[custom_comment_form]