When adding “User-Provided Data” in GA4 tags in Google Tag Manager, you need to… use a GTM variable with the type “User-Provided Data.
This tag has 3 modes
- Automatic Collection
- Manual Configuration
- Code
I would NOT recommend (1) – Automatic Collection. That setting scrapes the page body for data that looks like email addresses. You run the risk of sending customersupport@yoursite.com
to Google, messing up the data quality.
Manual Configuration is fine if you have the plain-text Email address in your dataLayer.
But what if you have a sha256 hashed email address in the dataLayer?
Then you need to use the (3) Code option. The Google documentation is only partly telling you how, so Here’s how I got it to work:
Use the Code, Luke
Assuming you have a variable {{sha256 email}}
already configure in your GTM:
Step 1: create a Custom Javascript variable. I call it: code - leadsUserData
This is a simple variable that returns the has in the correct format.
function() { return { 'sha256_email_address': {{sha256 email}} } }

Step 2: create a User-Provided Data variable in Code mode. I call it: user provided data - sha256 email

Flip on “Code” mode, and as Data source, use your leadsUserData
variable from step 1
Step 3: finally, you can add this variable to the Google Tag: Configuration settings in the parameter named user_data

Step 4: too obvious perhaps, but to be complete: Use this Configuration Settings variable in your Google Tag. Then everyting wil send properly to GA4
Preview, test, publish, test
Don’t forget to use Preview mode to see if data is flowing in correctly!
The outgoing hit should have parameters like
- user_date.sha256_email_address (value: the hash)
- user_data.__tag_mode (value: “CODE”)

That’s it. Happy tracking!
If you have questions: drop a comment, or ping me on BlueSky.
Leave a Reply