About cookies on this site

We use cookies to collect and analyse information on site performance and usage, to provide social media features and to enhance and customise content and advertisements. Learn more

Cookie settings

About cookies on this site

Cookies used on the site are categorized and below you can read about each category and allow or deny some or all of them. Learn more

Necessary

Some cookies are required to provide core functionality. The website won't function properly without these cookies and they are enabled by default and cannot be disabled.

Preferences

Preference cookies enables the web site to remember information to customize how the web site looks or behaves for each user. This may include storing selected currency, region, language or color theme.

Analytical cookies

Analytical cookies help us improve our website by collecting and reporting information on its usage.

Marketing cookies

Marketing cookies are used to track visitors across websites to allow publishers to display relevant and engaging advertisements. By enabling marketing cookies, you grant permission for personalized advertising across various platforms.

  • Courses
    • Paid courses
    • Course bundles
    • Free courses
  • Blog
  • Resources
    • Youtube channel
    • E-books and Guides
    • GTM Recipes
    • View All Resources
    • GTM Community
    • GA4 community
  • Services
  • About
    • About
    • Contact
  • Login
  • Courses
    • Paid courses
    • Course bundles
    • Free courses
  • Blog
  • Resources
    • Youtube channel
    • E-books and Guides
    • GTM Recipes
    • View All Resources
    • GTM Community
    • GA4 community
  • Services
  • About
    • About
    • Contact
  • Login

October 17, 2024

Data Redaction in Google Analytics 4

Updated: October 17th, 2024

Data redaction in Google Analytics 4 can safeguard against the collection of personally identifiable information (PII) that may unexpectedly find its way into your data.

For example, the URL of your form’s “Thank you” page might contain the visitor’s email address. This automatically will be tracked by Google Analytics (or any other analytics/marketing tools you use). So, you’re basically leaking user’s private information to other vendors. Luckily, this can be mitigated.

If you want to learn more about how to use the data redaction feature, its limitations, and other solutions to remove sensitive information from your data, keep reading!

 

Table of Contents

Here’s what you will learn in this article

  • Why is it important to redact sensitive data?
  • What data can be redacted?
  • How does data redaction work?
  • How to redact data
    • How to redact email data
    • How to redact URL query parameters
      • What are query parameters?
      • How to determine which query parameters are being collected
      • How to set which query parameters to redact
      • Testing query parameter redaction
  • Limitation to data redaction
  • What is the best solution?
  • Final Words

 

 

Video Tutorial

If you prefer video content, then check out the Analytics Mania Youtube channel for a video on Data Redaction in GA4.

 

Why is it important to redact sensitive data?

First, you are leaking personal information (even if it’s accidental). That’s not cool both from the ethical and legal perspective.

If that is not enough of an incentive for you, then keep in mind that sending personal info to GA4 (even accidentally) goes against the terms and services of Google Analytics. You can find more information under Section 7: Privacy of the Google Analytics Terms of Use. What does that mean? Technically, Google has the right to shut down your property due to this.

 

What data can be redacted?

Google Analytics 4 can redact sensitive information that may appear in the data in two ways: (1) Email and (2) URL query parameters. Currently, this feature is only available in web data streams.

Using common text patterns for email addresses, any data fitting the pattern will be redacted from your data before it even reaches Google Analytics 4.

Google Analytics 4 allows up to 30 user-defined query parameters to be selected for data redaction. This will only work with some parameters, including page_location, page_referrer, page_path, link_url, video_url and form_destination.

 

How does data redaction work?

Before getting into the step-by-step instructions, it is important to note that data will not be redacted retroactively. This means that the data redaction will only occur after it’s been implemented.

Data redaction works client-side, so when the Google Analytics 4 tracking code is activated, the query parameters are removed within the browser, and the data never reaches the Google servers.

Follow along below to learn how to implement the data redaction feature!

Subscribe and Get the Ebook - Mastering GA4 event tracking

How to redact data

To choose the information you want to redact from your data, click “Data streams” in the Admin section.

Then, click on the web data stream.

Lastly, scroll down and select the “Redact data” element.

 

How to redact email data

On any Google Analytics 4 properties created before October 2023, you will need to manually enable email data redaction. For properties built after, this will automatically be enabled.

Email redaction is enabled if there is a blue checkmark next to the Email feature. If it is not, then click on the slider element to enable it.

Now, GA4 will identify email addresses in all event parameters using common text patterns and redact the information.

One thing to note is that there is the chance that data may be falsely identified as an email because it follows the typical patterns of an email address. For example, any text containing “@domain.com” will be removed from the data, whether or not is an email address.

Subscribe and Get the Ebook - working with reports in ga4

How to redact URL query parameters

The data redaction feature also allows the selection of up to 30 user-defined query parameters to be redacted from your data.

 

What are query parameters?

Query parameters are extra information that may be added to page URLs that start after a “?” and are separated by “&”s. They may unexpectedly collect information, such as email, firstname or lastname.

 

How to determine which query parameters are being collected

If you’re not sure what query parameters you may be collecting in your data, you can create an Explore report to investigate your data.

Learn more about explorations in Google Analytics 4 here.

Under Explore, create a new Exploration.

Add “Page path + query string” as a dimension and “Event count” or “Active users” as a metric in the report.

To make the data easier to look at, add a filter to only have “Page path + query string” contains “?” so that you only see page URLs that contain query parameters and click “Apply”.

Drag the dimension into the Rows and the metric into the Values.

As you can see in the screenshot above, firstname and lastname query parameters are being collected in the data, so we must ensure that this data is redacted, and email is already redacted.

You can repeat this process with the other parameters that data redaction can be applied to (page_referrer, link_url, video_url, and form_destination).

 

How to set which query parameters to redact

Once you have determined which query parameters you want to exclude, return to the “Redact data” section as shown above.

Here, you can type the query parameters you would like redacted from the selected group of parameters mentioned above and then click “Enter” on your keyboard.

Once you have entered all the query parameters, click “Save”.

 

Testing query parameter redaction

There is a feature at the bottom of the page that allows you to test what happens when you select certain query parameters to be redacted. This is a good tool to use to ensure that your data will appear how you intended it to.

Enter a page URL containing the query parameters you want to exclude, and you can see how the data will appear after it has been redacted.

Since data redaction will only apply to data after it has been implemented, you will have to wait up to 24 hours to start to see the redacted data appear. Once this time has passed, you can go to the report that you created above to check that the data is being redacted as expected.

Now, you have successfully implemented data redaction in Google Analytics 4 for both emails and URL query parameters!

 

Limitation to data redaction

While the data redaction tool in Google Analytics 4 is a great way to safeguard against sensitive information making its way into your data, there are some limitations to consider.

First, the parameter you are redacted is not entirely removed from the page path, resulting in messier data than if the query parameters were just removed from the page path.

If you want to learn more about how you can exclude URL query parameters in Google Analytics 4 using GTM, read the article here. In this case, the data redaction is a good second layer of protection.

Second, if you send data using the measurement protocol (sending data directly from your server to Google Analytics 4) or using the data import feature, then data redaction will not work since there is no opportunity for the data to be modified before it’s sent to GA4.

 

What is the best solution?

So, what is the best way to ensure that sensitive information isn’t tracked in Google Analytics 4? Block it from the source!

The best solution is not to include sensitive information in the URL. You can work with your developers to ensure that sensitive information doesn’t make its way into the URL by blocking it from the source.

This data redaction feature only works for GA4, not any other tracking applications you may be using, so you must ensure that this information is not making its way into another tool, too.

 

Date redaction in Google Analytics 4: Final Words

While the data redaction feature is something that you should consider enabling to ensure that sensitive information is not entering your data, there are other actions that you can take to protect your users further and improve your reporting. Data redaction should be treated as a second layer of protection.

Ultimately, it would be best if you tried to ensure that your website does not allow sensitive data to enter into the page URL. However, if this is not possible, then you can at least exclude URL query parameters from appearing in reports.

Hopefully, this tutorial has been helpful in guiding you to a solution for safeguarding against any sensitive information entering your data!

 

Julius Fedorovicius
In Google Analytics Tips
5 COMMENTS
Anna
  • Jan 12 2024
  • Reply

Is it also possible to redact unique identifiers in urls? For example, my url ends with: login/111-345-abc-1010 and I want to redact "111-345-abc-1010".

    Julius Fedorovicius
    • Jan 12 2024
    • Reply

    Not with this feature

Diego
  • Mar 27 2024
  • Reply

Once you enable data redaction, does that redacts historical data as well?

    Julius Fedorovicius
    • Mar 27 2024
    • Reply

    no

Leo Farmer
  • May 18 2025
  • Reply

Is there any way, not necessarily this feature, to redact segments from the url e.g. https://example.com/userid/12345/orderno/9876 redacted to https://example.com/xxxx/12345/orderno/xxxx. I've had a play with variables in the tag, but this doesn't seem to work.

Leave a comment Cancel reply

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


 

Hi, I'm Julius Fedorovicius and I'm here to help you learn Google Tag Manager and Google Analytics. Join thousands of other digital marketers and digital analysts in this exciting journey. Read more
Analytics Mania
  • Google Tag Manager Courses
  • Google Tag Manager Recipes
  • Google Tag Manager Resources
  • Google Tag Manager Community
  • Login to courses
Follow Analytics Mania
  • Subscribe to newsletter
Recent Posts
  • How to Set Up Google Tag Manager Server-side Tagging with Cloud Run
  • Quick Guide: dataLayer.push with examples
  • Google Tag Manager Server-Side Tagging with Stape
Analytics Mania - Google Tag Manager and Google Analytics Blog | Privacy Policy
Manage Cookie Settings