A Simple Fix to Stop Sending Personal Identifiable Information to Google Analytics 4

  • Magda Baciu

    Magda Baciu

    CRO & Data Specialist

Intro

With the new Google Analytics (GA4) release, the common problem-fixes for Google Universal Analytics are no longer producing the expected results.

Such is the case for removing the PII (Personal Identifiable Information) from links via GTM (Google Tag Manager). 

As you may know, the best way to stop your Analytics from collecting emails, names, addresses, or phone numbers, is through Google Tag Manager.

However, when migrating your existing Google Tag Manager solution for this issue to the new Google Analytics 4, you’ll notice changes that render it obsolete.

This is a well-known problem that can be fixed quickly by following a 2-step process that we share with you below.

A Simple Fix to Stop Sending Personal Identifiable Information to Google Analytics 4

Step 1 – Create a new custom JS variable

To begin this setting, go to Google Tag Manager and create a new Custom JavaScript variable.

A Simple Fix to Stop Sending Personal Identifiable Information to Google Analytics 4

Once you’ve created the variable you’ll need a specific piece of JavaScript code that we can send via email. Once you have that code, copy and paste it inside. Get your ready-to-implement code by adding your email address in the box found at the end of this post.

Your result should look exactly like this.

A Simple Fix to Stop Sending Personal Identifiable Information to Google Analytics 4

The code tells Google Tag Manager not to send the information within specific parameters further to Google Analytics. 

As you can see, our example uses parameters such as ‘email,’ ‘name,’ ‘phone ‘address,’ or ‘city’. However, you can add or remove parameters at your own will.

So, if your website uses other parameters that contain Personally Identifiable Information, feel free to add them to the code – just make sure to follow our format.

Step 2 – Google Analytics 4 Configuration

If you’re implementing Google Analytics 4 via Google Tag Manager, the first thing you have to configure is the new Google Tag Manager tag named ‘Google Analytics: GA4 Configuration’.

A Simple Fix to Stop Sending Personal Identifiable Information to Google Analytics 4

Once you have that in place, all that’s left is to add a new row on ‘Fields to Set’ named ‘page_location.’ Make sure you include the newly created JS variable as ‘Value.’

Here is how this setting should look like:

A Simple Fix to Stop Sending Personal Identifiable Information to Google Analytics 4


Now click on Save and Preview this change, and you’re all done. From this point on, the page location will exclude Personally Identifiable Information parameters, and your new Google Analytics 4 is ready to go. 

Easy enough?

Of course it was. Plus having your users feel safe when using your online solutions – priceless.

Removing Personally Identifiable Information from Google Analytics 4 with Google Tag Manager is a simple and effective solution to stay compliant with privacy policies in the EU and not only. We do this for all of our clients to make sure they don’t cross GDPR rules since using personal information for any marketing or other purposes became highly illegal.

Now it’s easy for you to do so as well. We’re sharing our custom code so it’s super easy for you to implement right away!

Fix PII Tracking Problems in 5 Minutes or Less

A Simple Fix to Stop Sending Personal Identifiable Information to Google Analytics 4

Author

  • A Simple Fix to Stop Sending Personal Identifiable Information to Google Analytics 4

    Forbes 30 under 30. Data Science at Oxford. Head of a fast-growing agency and the person who’ll make your data make sense. Magda combines psychology, behavioral marketing and deep data expertise to create the right growth strategy for your business. (And she likes pandas. A lot.)

    View all posts

Fix PII Tracking Problems in 5 Minutes or Less

Learn From Us And Nail Advertising, Conversion Optimization, and Data Tracking

Free resources shared with our community only.

We're committed to your privacy. You may unsubscribe from these communications at any time. For more information, check out our privacy policy.

Marketing by

Leave a Reply

  • Hi, Thank you for the script to remove pii from ga4. we have followed the steps you have showed but still the PII values goes to GA4. the changes not reflecting on page_location variable. do you have any fix for that?

growthsavvy growthsavvy