On this page
What this issue is
The dataLayer is a JavaScript list (window.dataLayer) that your site uses to pass information to Google Tag Manager (GTM). Developers push things like the page type, product ID or order value into it. PII (personally identifiable information) means data that identifies a person: an email address, phone number, full name, home address or similar.
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'lead_form_submit',
user_email: 'jane@example.com',
user_phone: '+441234567890'
});Why it costs you leads or sales
Google Analytics terms forbid sending personal data to GA4, and other ad platforms have similar rules. If a tag forwards an email as an event parameter, the platform may delete the data, flag the property, or restrict features. Privacy laws such as GDPR and CCPA also apply, so unplanned sharing can create legal exposure and force you to pause tracking while you clean up.
- Visitor submits formEnters email and phone
- Script pushes to dataLayerEmail sent as plain text
- GTM tags read variablesAny tag can use the value
- Platforms receive PIIGA4, Ads, Meta hits contain it
The break is the plain-text push; everything after it carries personal data.
Personal data moves from the page into tags and out to platforms.
How to check if your site has it
Inspect the dataLayer in the browser
Open your site, open DevTools, go to Console and type
dataLayer. Submit a test form with a fake address such as test@example.com, then look for that address in the list.Use GTM Preview modeGoogle Tag Manager
In GTM click Preview, load your site, submit the form and open the Data Layer tab for each event. Check every key and value for emails, phones or names.
Check the network hits
In DevTools open Network, filter for
collect,facebook.com/trorgoogleads, submit the test form and search the request URLs and payloads for your fake email or phone.Review variables and tagsGoogle Tag Manager
In GTM go to Variables and look for Data Layer Variables named email, phone, name or address. Check which tags use them in Tags > each tag's fields.
Check URLs too
Look at thank-you page URLs and query strings. Addresses like
?email=jane@example.comare also picked up by page_location.
How to fix it
Decide first what each platform actually needs. Most conversion tracking needs only an event name, a value and an ID. If you use Google Ads enhanced conversions or Meta advanced matching, the platform expects user data, but it should be sent through that feature (which hashes it), not as a custom parameter.
Remove the fields from the push
Delete
user_emailanduser_phonefrom thedataLayer.pushcall, keeping only event name and non-personal values.Hash if a platform needs it
If you need to pass an email for matching, hash it with SHA-256 after trimming and lowercasing, and send it only to the tag that requires it.
Stop tags using the variable
Open each tag that uses a PII variable and remove the field or parameter.
Delete unused PII variables
After removing usage, delete the Data Layer Variables for email and phone, or rename them clearly if used for enhanced conversions.
Use enhanced conversions settings
In the Google Ads conversion tag, use the user-provided data option so Google hashes values, instead of adding an email parameter to GA4.
Add a redaction layer
In GA4 configuration, use the built-in redact options and a custom variable to strip email patterns from page_location if needed.
Check your form and tracking plugins
In plugin settings for tools that push form data to the dataLayer, turn off options that include field values.
Check theme and custom snippets
Search theme files and header snippets for
dataLayer.pushcontaining field values.
Check theme code and pixels
In Online Store > Themes > Edit code, search for
dataLayer.pushandcustomer.email. Remove Liquid output of customer email or phone from tracking snippets.Review Customer events
In Settings > Customer events, check custom pixels for code that forwards email or phone.
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'lead_form_submit',
form_id: 'contact_main',
lead_type: 'quote_request'
});Before
- Email and phone pushed in plain text
- Any tag can read and send them
- Platform may reject or flag data
After
- Only event name and non-personal IDs
- User data sent only through hashing features
- Hits contain no readable personal data
How to confirm it's fixed
- Submit a test form with a fake email and phone, then search the dataLayer in the Console for them: no matches
- GTM Preview Data Layer tab shows no email, phone or name values
- Network requests to GA4, Google Ads, Meta and others contain no readable test email or phone
- Thank-you page URL has no personal data in the query string
- GA4 DebugView events show no PII parameters
- Enhanced conversions diagnostics in Google Ads show hashed data only, if you use it
How to prevent it happening again
- Keep a written data-layer spec listing allowed keys; no personal fields
- Review every new form, plugin or tag in GTM Preview before publishing
- Limit who can publish GTM changes and add a note to each version
- Never put personal data in URLs or query strings
- Re-test key forms after redesigns, plugin updates and agency changes
- Tie any user-data sending to your consent setup
How FunnelGuard handles this
FunnelGuard covers this issue partly. Its no_pii_in_tracking check looks at the tracking hits your funnel sends to ad and analytics platforms during a scheduled test journey, and flags personal data it finds in those hits. It does not read your dataLayer directly, so a plain-text email that sits in the dataLayer but is never sent in a hit is not reported.
Questions people ask
What is PII in the dataLayer?
It is personal data such as an email address, phone number or name stored in the dataLayer list that Google Tag Manager reads. Once it is there, any tag can use it and send it to platforms like GA4, Google Ads or Meta.
How do I check if my dataLayer contains an email address?
Open your site, type dataLayer in the browser Console, and submit a form with a fake email. Also use GTM Preview and its Data Layer tab. Search for your test email in both and in the Network tab hits.
Is it allowed to send emails to Google Analytics?
No. Google Analytics terms prohibit sending personally identifiable information to GA4. If it happens, the data may be deleted and the property may be restricted, so remove it from tags and events.
Can I send hashed emails to Google Ads or Meta?
Yes, through features built for it, such as Google Ads enhanced conversions or Meta advanced matching. Trim and lowercase the value, hash it with SHA-256, and only send it with the right consent. Hashed data is still treated as personal data in many regions.
How do I remove PII from the dataLayer in GTM?
Remove the personal fields from the dataLayer.push code, stop tags using the related Data Layer Variables, and delete variables you no longer need. Then test in Preview mode and check network hits.
Why is there an email in my GA4 page URL?
A form or thank-you redirect probably adds it as a query string such as ?email=. GA4 records page_location, so the email is stored. Change the form to use POST or a session ID, and remove the parameter.
Does FunnelGuard detect PII in my dataLayer?
Only partly. FunnelGuard's no_pii_in_tracking check inspects the tracking hits sent during test journeys, not the dataLayer itself. You should still inspect the dataLayer by hand.
Related issues
- TRK-113Variables returning undefined (dataLayer key renamed)Fix guide
- TRK-116Tag firing in preview but blocked by consent settings in liveFix guide
- TRK-117Built-in consent checks misconfigured in GTMFix guide
- TRK-115Custom HTML tag throwing JavaScript errorFix guide
- TRK-107Form submission trigger not firing for AJAX formsFix guide
- TRK-122sGTM forwarding to GA4 broken while browser hit succeedsFix guide