On this page
What this issue is
The dataLayer is a JavaScript array (window.dataLayer) that your site uses to pass information to Google Tag Manager (GTM) or other tag tools. Anything pushed into it becomes a value that any tag or variable in the container can read.
The problem starts when a developer, plugin or theme pushes raw personal data into it. Typical examples are a form plugin pushing the submitted email, a checkout pushing the full billing address, or a login event pushing the user's name. If a tag is set to send the whole dataLayer, or a variable is reused across tags, that data goes to every vendor, not just the one that needs it.
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'form_submit',
form_id: 'contact',
user_email: 'jane.doe@example.com',
user_phone: '+44 7700 900123',
user_name: 'Jane Doe'
});- Form submitPlugin pushes email and phone into dataLayer
- GTM containerAll tags can read the values
- GA4 and Google AdsReceive the PII as parameters
- Meta, TikTok, othersReceive the same PII
Raw PII in the dataLayer is available to every tag that fires on the event.
Why it costs you leads or sales
Sending personal data to ad and analytics vendors without a lawful basis or consent can breach privacy laws such as GDPR and CCPA, and breaks the terms of most platforms. Google Analytics, for example, forbids sending PII to it. The result is not just legal risk. The business effects are practical too.
| Consequence | What happens |
|---|---|
| Data deleted or blocked | A platform may delete the affected data or suspend the property or account for policy breach, which damages reporting and campaigns. |
| Consent breach | Data goes to vendors before or without consent, which can lead to complaints and fines. |
| Lost trust | Customers who learn their email was shared with ad networks may stop buying or filling in forms. |
| Polluted audiences | Unplanned identifiers in ad platforms make audiences and reports hard to clean up. |
How to check if your site has it
Inspect the live dataLayer
Open your site in Chrome, open DevTools, go to the Console and type
dataLayer. Expand the entries and look for emails, phone numbers, names and addresses. Then submit your forms and run a test checkout, and look again.Use GTM Preview modeGoogle Tag Manager
In Tag Manager click Preview, enter your URL and run the journey. In Tag Assistant, click each event and open the Data Layer tab to see what was pushed.
Check which tags read itGoogle Tag Manager
In Preview, open the Variables tab for each event. Note any variable holding PII and which tags use it.
Inspect outgoing requests
In DevTools open the Network tab and filter for
collect,g/collect,trandevents. Look in the query string and payload for emails, phone numbers or names. Plain text or encoded values both count.Search your code and plugins
Search your theme and plugin code for
dataLayer.pushand review which fields are included. Check form, checkout and membership plugins in particular.
How to fix it
The principle is simple: keep raw PII out of the dataLayer, and where a vendor needs a user identifier for matching, send it to that one vendor in the format it documents, only with the right consent.
Remove PII from the pushes
Change the code, plugin setting or template that pushes the personal fields. Push non-identifying data instead, such as
form_id,lead_typeor an internal ID that cannot be traced to a person without your own database.Find tags that send the whole dataLayer
Review each tag for custom parameters that map PII variables, and for settings that pass extra fields. Remove those mappings.
Block PII with a sanitising variable or ruleGoogle Tag Manager
As a safety net, use a Custom JavaScript variable or a GTM transformation to remove or mask fields before tags read them. Do not rely on this alone.
Send identifiers only where the vendor asks for them
If Meta or Google Ads needs customer data for matching, use that vendor's documented feature (for example enhanced conversions or Advanced Matching) in that tag only, and only when consent allows it.
Gate tags on consent
Make sure tags that handle identifiers only fire after the right consent signal is granted.
Publish and clean up
Publish the container, then check the vendors' own tools for stored PII and follow their deletion process where needed.
Check form and shop plugins
Open the settings of your form plugin, WooCommerce or GTM plugin and look for options like 'include user data' or 'add customer data to dataLayer'. Turn them off.
Search theme and child theme
Search
functions.phpand plugin files fordataLayer.pushand remove personal fields.
Review theme code
In Online Store > Themes > Edit code, search for
dataLayer.pushand for Liquid objects likecustomer.emailorcheckout.emailinside script tags.Check apps and Customer events
Review tracking apps and custom pixels under Settings > Customer events so they do not pass email or phone to every vendor.
Audit variables
In Variables, find Data Layer Variables for email, phone and name. Check which tags use them and remove the mappings.
Add a transformation or sanitising variable
Use a transformation to exclude or redact the PII parameters, or a Custom JavaScript variable that returns a cleaned value.
Check custom code
Open Project settings > Custom code and page-level embeds, and search for
dataLayer.pushwith form values.Review form scripts
Make sure form submit scripts push only a form name or ID, not the field values.
Check custom code and tracking scripts
In funnel and website settings, review header, footer and custom code blocks for scripts that push form fields into the dataLayer.
Limit what is passed on
Keep contact fields out of scripts that feed ad pixels. Use the platform's own conversion options for vendors that need them.
Review Marketing Integrations
Check Marketing Integrations and any custom code under Settings > Custom code for scripts pushing user details.
Check Velo code
If you use Velo, search for
dataLayer.pushin page and site code and remove personal fields.
Check code injection
Open Settings > Advanced > Code Injection and review header, footer and order confirmation code for pushes with customer data.
Review form block scripts
Make sure any form submit script does not copy the field values into the dataLayer.
Whitelist fields
Wrap pushes in a helper that only allows approved keys, so new PII fields cannot slip in.
Remove server-rendered PII
Check templates that print user data into an inline
dataLayer.pushon the page.
var ALLOWED = ['event', 'form_id', 'lead_type', 'value', 'currency', 'transaction_id'];
function safePush(obj) {
var clean = {};
Object.keys(obj).forEach(function (k) {
if (ALLOWED.indexOf(k) !== -1) clean[k] = obj[k];
});
window.dataLayer = window.dataLayer || [];
window.dataLayer.push(clean);
}
safePush({ event: 'form_submit', form_id: 'contact', user_email: 'jane@example.com' });
// user_email is droppedBefore
- Push includes email, phone and name
- Every tag can read those values
- PII appears in GA4, Meta and other requests
After
- Push has only form ID and event name
- Tags receive no raw personal data
- Vendor matching, if used, is set per tag with consent
How to confirm it's fixed
- Console
dataLayershows no email, phone, name or address after a test form and checkout - GTM Preview shows no PII in any event's Data Layer tab
- Network requests to GA4, Google Ads, Meta and others contain no test email or phone
- Searching your vendor reports for the test email returns nothing
- Tags that use identifiers fire only after consent is granted
- A repeat test on mobile and in a private window gives the same result
How to prevent it happening again
- Keep a written data layer spec listing the allowed keys
- Use an allow-list helper or GTM transformation as a safety net
- Review plugin and theme updates for new tracking options
- Review container changes before publishing and test in Preview
- Repeat the Network tab check with a fake email after each release
- Limit who can add custom HTML tags to the container
How FunnelGuard handles this
FunnelGuard detects this issue only partly. It runs your real journeys with a robot visitor and checks the tracking hits sent to platforms such as GA4, Google Ads, Meta, TikTok, LinkedIn, Bing, Pinterest, Snapchat, X and Reddit. That means it can show you whether the expected hits fire at each step, which is the evidence you need to start looking at what those requests contain.
What it does not do is inspect every dataLayer push for personal data or judge whether a value in a vendor request counts as PII. It also cannot see what a vendor stores after receiving a hit. Cover the rest by hand: inspect dataLayer in the console, use GTM Preview, search the Network tab for a fake test email, and review your container whenever it changes. A free read-only website audit is available, and the Free plan covers 1 site and 2 journeys with daily checks and no card.
Questions people ask
What is PII in the dataLayer?
It is personal data such as an email address, phone number, name or home address pushed into the dataLayer array. Any tag in Google Tag Manager can read these values, so they can be sent to several vendors at once.
Why is my email address showing up in GA4 or Meta?
Most often a form or checkout plugin pushes the email into the dataLayer, and a tag or variable maps it into an event parameter. Check GTM Preview and the Network tab to see which tag sends it, then remove the mapping and the push.
How do I check my dataLayer for personal data?
Open DevTools, type dataLayer in the Console and expand the entries after submitting a form with a fake email. Then use GTM Preview and the Data Layer tab on each event. Finally search the Network tab for the fake email.
Is it illegal to put emails in the dataLayer?
The dataLayer itself is not illegal, but passing personal data on to ad and analytics vendors without a lawful basis or consent can breach laws like GDPR. Google Analytics also prohibits sending PII. Ask your privacy lead or lawyer about your specific case.
How do I stop GTM sending PII to every tag?
Remove PII from the pushes at the source, delete variable mappings to PII in tags, and add a transformation or sanitising variable as a safety net. Send identifiers only to the vendor that needs them, using its documented feature and consent.
Can I send hashed emails instead of plain emails?
Some vendors ask for hashed customer data through features like enhanced conversions or Advanced Matching. Use those only in the relevant tag and with the right consent. Hashing is not a free pass to send it to every vendor.
Can FunnelGuard detect PII in my dataLayer?
Only partly. It checks that your tracking hits fire on real journeys, but it does not inspect every dataLayer push for personal data. Use the console, GTM Preview and the Network tab to cover the rest.
Related issues
- TRK-355Email address in page URL query string sent to GA4Fix guide
- TRK-356Phone number in event parametersFix guide
- TRK-357Name or address in thank-you URL sent to pixelsFix guide
- TRK-359PII in page_title ("Thanks John")Fix guide
- TRK-361Hashed PII sent without consentFix guide
- TRK-358Form field values sent in GA4 click textFix guide