A simple 2-step guide for removing PII from GA4 with GTM

  • Alex

    Author: Alex

    Head of Data Engineering

  • Magda Baciu

    Author: Magda Baciu

    Founder & Head of Strategy

  1. What’s changed in GA4 compared to Universal Analytics?
  2. Creating the JS Variable
  3. GA4 Configuration

Intro

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

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

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

However, when migrating your existing GTM solution for this issue to the new GA4, 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. 

Step 1 – Create a new custom JS variable

To begin this setting, go to GTM and create a new Custom JavaScript variable.

Once you’ve created the variable, you will be able to insert the custom code. Get your ebook on How To Do Conversion Optimization Research Part 1

Your result should look exactly like this.

The code tells GTM not to send the information within specific parameters further to GA. 

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 PII, feel free to add them to the code – just make sure to follow our format.

Step 2 – GA4 Configuration

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

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:


Now click on Save and Preview this change, and you’re all done. From this point on, the page location will exclude PII parameters, and your new GA4 is ready to go. 

Easy enough? 

More tips, how-to guides, and articles are coming.  If you’d like to be the first who gets to read them, make sure to subscribe to our newsletter. We promise not to spam you or share your email with anyone else.

You can also show your support by hitting that share button and letting more people in on this know-how. 

Plus, if you’d like our experts to configure your Analytics or GTM or provide support in any marketing-related matter, fill in our contact form below, and we’ll rush to your assistance. 

See you next time! 

Author

Alex Head of Data Engineering
Read more Read more After working in web development and analytics for 5 years, there is NO WAY Alex will let you do anything before he’s got a whole data architecture engineered into your website. His motto: “In God we trust. All others must bring data.” Don’t be intimidated, though. He’s super patient and human about it
Magda Baciu Founder & Head of Strategy
Read more Read more Magda started marketing for friends by stealing candies from her mom’s shop to distribute. She now does the grown-up thing and studies data science at Oxford University. She’s quite overfocused on marketing, statistics, and data. Between that and her hobbies in learning genetics, understanding psychology, doing exercise, and watching pandas, she doesn’t have much time left for the latest movies. Throw a Harry Potter her way – and super-educated Magda won’t get it at all.

Insert your details below and get the code now

Leave a Reply