First-Party Data Enrichment for Meta CAPI and Google Ads
Learn how to enrich Meta CAPI and Google Ads enhanced conversions with hashed first-party match keys in server-side GTM, while keeping GA4 free of PII.
Syed Yasir
Conversion Tracking & Server-Side Attribution Expert
Table of Contents
Short answer: First-party data enrichment means adding consented, first-party match keys to your server-side conversion events before they reach ad platforms. In server-side GTM, you normalize and SHA-256 hash email, phone and name, attach click IDs and a shared event_id, send the right fields to Meta Conversions API and Google Ads enhanced conversions, and keep GA4 free of personal data. Each platform has its own normalization rules, so one hashing function does not fit both.
What is first-party data enrichment?
First-party data enrichment is the practice of taking a raw conversion event from your website, such as a purchase or lead form submission, and adding attributes you collected directly from your customers. This usually happens in a server-side Google Tag Manager (sGTM) container or a backend webhook, after the visitor has given the consent your region requires.
Typical enrichment fields:
- Hashed customer match keys: email, phone, first and last name, and address fields, each normalized to the destination’s rules and hashed with SHA-256 where the platform requires it.
- Click and browser identifiers:
gclid,gbraidorwbraidfor Google Ads, andfbcandfbpfor Meta. - Order context: order ID, value and currency.
- Deduplication keys: a shared
event_idso the browser Pixel and Conversions API can be reconciled.
Why do bare conversion events underperform?
A conversion event with no match keys gives the platform little to connect to a real ad interaction.
- Meta can only use matched events. Meta’s documentation says events matched to a Facebook or Meta account can be used for ads attribution and delivery optimization, while unmatched events can only be used for basic measurement. Event Match Quality (EMQ) is scored out of 10 for web events in Events Manager.
- Google matches hashed data to signed-in Google accounts. Enhanced conversions sends hashed first-party data alongside the conversion tag so Google can attribute conversions to ad events. Google describes the feature as improving measurement accuracy and unlocking more powerful bidding.
- Timing matters. Meta advises that sending Conversions API events more than 2 hours after they happen can significantly reduce performance for ads optimized on them. A real-time server pipeline helps here.
Which match keys does each platform accept, and how must they be formatted?
This is where many implementations break. Meta and Google differ on both what to hash and how to normalize. Sending Meta-formatted values to Google, or the reverse, causes failed matches without an obvious error.
| Field | Meta Conversions API | Google Ads enhanced conversions |
|---|---|---|
| Trim spaces, lowercase, then hash | Trim spaces, lowercase, remove dots in the username for gmail.com and googlemail.com, then hash |
|
| Phone | Digits only with country code, no symbols or leading zeros (for example 16505551212), then hash |
E.164 with a plus sign (for example +11231234567), then hash |
| First and last name | Lowercase, no punctuation, UTF-8 if special characters, then hash | Trim spaces, lowercase, then hash |
| Street address | Not a Meta field | Hash |
| City, state, postal code, country | Normalize (lowercase, no spaces, ISO 3166-1 alpha-2 country code) and hash | Do not hash (country uses ISO 3166-1 alpha-2) |
| External ID | Hashing recommended | Not applicable |
| Click ID | fbc: do not hash |
gclid, gbraid or wbraid: not hashed |
| Browser ID, IP, user agent | fbp, client_ip_address, client_user_agent: do not hash |
Not applicable |
Other requirements worth knowing:
- Meta requires at least one customer information parameter per event. For website events it also requires
action_source,event_source_urlandclient_user_agent, and recommendsevent_idandexternal_idon every event. Certain combinations of weak parameters alone (for examplefnplusge) are rejected. - Google Ads needs either an email, or an address with first name, last name, postal code and country. Email is preferred. Hashes must be hex-encoded SHA-256.
- Google Ads click IDs: each uploaded conversion takes exactly one of
gclid,gbraid(iOS app conversions) orwbraid(iOS web conversions).
How does a server-side enrichment pipeline work?
A privacy-safe pipeline separates collection, enrichment and routing.
1. Capture consented inputs and a deterministic event ID
On high-intent steps (order confirmation, lead submission), generate one event_id per event, for example the order ID, and send it from both the browser and the server. Keep raw personal data out of URL query strings and GA4 parameters.
For Meta deduplication, the browser event and the server event need the same event_name and event_id, and Meta also expects fbp and/or external_id to be used consistently across both. Meta discards the later of two matching events received within 48 hours.
2. Normalize and hash on the server
Hash on your server, not in visitors’ browsers, so each platform’s rules are applied in one place. The function below follows the Meta and Google rules from the table above:
import { createHash } from 'node:crypto';
const sha256Hex = (value) => createHash('sha256').update(value, 'utf8').digest('hex');
// Meta Conversions API: trim and lowercase, then hash
export const metaEmail = (email) => sha256Hex(email.trim().toLowerCase());
// Google Ads: trim and lowercase, and remove dots in the username
// for gmail.com and googlemail.com, then hash
export function googleEmail(email) {
const [user, domain] = email.trim().toLowerCase().split('@');
const cleanUser =
domain === 'gmail.com' || domain === 'googlemail.com' ? user.replaceAll('.', '') : user;
return sha256Hex(`${cleanUser}@${domain}`);
}
// Meta: digits only with country code, no leading zeros
export const metaPhone = (e164) => sha256Hex(e164.replace(/\D/g, '').replace(/^0+/, ''));
// Google Ads: E.164 including the plus sign, for example "+11231234567"
export const googlePhone = (e164) => sha256Hex(e164);
These outputs match the example hashes published by Meta ([email protected] and 16505551212) and Google ([email protected] and +11231234567). In a server container custom template, Google provides the sha256Sync helper; see Google’s server-side tagging APIs reference. If you send unhashed values through the Google tag, Google can normalize and hash them for you. Meta’s Business SDK also hashes automatically.
3. Enrich inside sGTM
Your server container is the enrichment hub. Host it on a first-party origin so server-set cookies, including fbp and fbc, last longer in Safari. The setup is covered in our guide to extending cookie lifetime past Safari ITP with same-origin sGTM. The server can then attach:
- Click IDs stored from the visitor’s landing session.
- Order ID, value and currency from your commerce backend or CRM.
- Hashed match keys from the consented form or checkout submission.
For Google Ads in sGTM, Google documents the Google Ads User-provided Data Event tag. It needs a Conversion Linker tag and a GA4 client in the server container.
4. Route each destination only the fields it should get
Here is a Meta Conversions API payload after enrichment. The hashes are the Meta documentation’s example email and a demo external ID, and the IP address is from a reserved documentation range:
{
"data": [
{
"event_name": "Purchase",
"event_time": 1796515200,
"event_id": "ord_91402",
"action_source": "website",
"event_source_url": "https://yourdomain.com/checkout/thank-you",
"user_data": {
"em": ["62a14e44f765419d10fea99367361a727c12365e2520f32218d505ed9aa0f62f"],
"external_id": ["643eb5e088470a5d0eda00a63788177a589ff29836f5bfc144f1ef76a325b720"],
"fbc": "fb.1.1554763741205.AbCdEfGhIjKlMnOpQrStUvWxYz1234567890",
"fbp": "fb.1.1596403881668.1116446470",
"client_ip_address": "203.0.113.10",
"client_user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"
},
"custom_data": {
"currency": "USD",
"value": 129.0,
"order_id": "ord_91402"
}
}
]
}
Notice that fbc and fbp use the format Meta documents (fb.<subdomain index>.<creation time in milliseconds>.<value>), and that IP address and user agent are sent unhashed.
| Destination | Match keys it receives | Notes |
|---|---|---|
| GA4 | None in event parameters | Strip raw and hashed personal data centrally in sGTM |
| Meta CAPI | Hashed contact fields, plus unhashed fbc, fbp, IP address and user agent |
Shared event_id, consistent event_name |
| Google Ads | Hashed email, phone, name and street, plus unhashed country, region, city and postal code, and one click ID | Requires ad_user_data consent to be granted |
Can you send hashed email to GA4?
Not in event parameters. Google’s policies prohibit sending personally identifiable information to Google Analytics, and its PII guidance names email addresses as an example. Data redaction in GA4 removes email addresses only on a best-effort basis, so do not rely on it as your control.
There is one sanctioned exception: GA4’s user-provided data collection feature. Its policy allows PII for that feature only if the data is first-party, hashed with SHA-256 (Google tagging code does this automatically), and sent with user consent. Country, state, city and zip code are not hashed in that feature either.
Is hashed data still personal data?
Treat it that way. The US Federal Trade Commission has said plainly that hashing does not make data anonymous, because a hash is still a persistent identifier that can track a person or device over time. Practical consequences:
- Do not describe hashed identifiers as “anonymous” in your privacy policy or marketing.
- Apply the same consent, retention and access controls to hashed data as to raw data.
- Do not log raw email addresses or phone numbers in server logs while you normalize them.
What consent guardrails do you need?
- Consent Mode v2 for EEA and UK traffic. Google says consent mode (or a TCF-based setup) is required for measurement, ad personalization and remarketing features for users in the EEA, and it advises implementing consent mode for traffic in the EEA and the UK. Consent mode v2 adds
ad_user_dataandad_personalizationtoad_storageandanalytics_storage. ad_user_datagates enhanced conversions. Google states this consent type is required for measurement use cases such as enhanced conversions. When it is denied, use of user-provided data for online advertising is disabled.- Set defaults deliberately. Google lets you set default consent states globally and region by region. Choose defaults that match the opt-in rules where your visitors are, and confirm them with your legal advisor, because requirements vary by country and state.
- Google tags are consent-aware on the server; others are not automatically. Google documents that Google product tags in the server container adjust to the consent signals they receive. Google’s consent handling covers Google product tags, so for a Meta Conversions API tag, check whether your template has its own consent check and, if not, add a consent condition to its trigger.
- Normalize before you hash. An unnormalized hash will not match the platform’s own hash of the same value.
Our Consent Mode V2 setup guide walks through the implementation.
How do you verify the setup before scaling spend?
- Preview the server container. Confirm each event arrives with the consent signals and the expected fields, and that GA4 tags carry no personal data.
- Meta Test Events. Check that server events arrive, that browser and server events are deduplicated, and review EMQ in Events Manager after live traffic arrives. Meta recommends using your own customer details for test events.
- Google Ads diagnostics. Confirm the conversion action reports enhanced conversions as active. Google says impact results appear in the conversion action table about 30 days after a successful setup.
- Re-check deduplication whenever you change event names or IDs in either the browser or server container.
Common mistakes
- Hashing city, state, postal code and country for Google Ads. Google says not to hash them. Meta requires them hashed.
- Using one phone format for both platforms. Meta wants digits with a country code, Google wants E.164 with a plus sign.
- Hashing
fbc,fbp, IP address or user agent for Meta. They must stay unhashed. - Mismatched
event_nameorevent_idbetween Pixel and Conversions API, which defeats deduplication. - Uploading more than one click ID per Google Ads conversion.
- Sending PII, hashed or raw, in GA4 event parameters or URLs.
- Sending events late. Delays over 2 hours can hurt Meta optimization.
Not sure whether your pipeline matches these rules? Run our Server-Side Tracking Checker, or read our Server-Side Tracking guide.
Frequently asked questions
What is first-party data enrichment?
It is the process of adding consented, first-party attributes, such as normalized and SHA-256 hashed email or phone, click IDs, order data and a shared event ID, to server-side conversion events before they reach ad platforms. The goal is better matching of conversions to ad clicks and users.
Does Meta require hashing for Conversions API customer data?
Yes for contact information. Meta’s systems are designed not to accept unhashed contact information such as email, phone and names. Click ID (fbc), browser ID (fbp), client IP address and client user agent are not hashed.
Do Google Ads and Meta normalize data the same way?
No. Google Ads asks for E.164 phone numbers with a plus sign and removes dots from the username of gmail.com and googlemail.com addresses before hashing, while Meta wants digits only with a country code. Google says not to hash country, state, city and zip code, while Meta requires those fields hashed.
Is hashed data anonymous?
No. The FTC states that hashing does not make data anonymous, because a hash is still a persistent identifier. Treat hashed identifiers as personal data.
Can I send hashed emails to GA4?
Not as event parameters. Google prohibits sending PII to Google Analytics. The only sanctioned route is GA4’s user-provided data collection feature, which requires hashing (done automatically by Google tagging code), user consent and adherence to its policy.
How do I stop Meta from counting a conversion twice?
Send the same event_name and event_id from the browser Pixel and Conversions API, and keep fbp and external_id consistent. Meta deduplicates matching events received within 48 hours.
Sources and last verified
Last verified against official documentation on 6 December 2026. Platform requirements change, so re-check the linked pages before you deploy.
- Meta: Customer information parameters
- Meta: Conversions API best practices
- Meta: Handling duplicate Pixel and Conversions API events
- Meta: Conversions API end-to-end implementation
- Google Ads: About enhanced conversions
- Google Ads: Set up enhanced conversions for web using the Google tag
- Google Ads API: Manage online click conversions
- Google: Google Ads User-provided Data Event tag in server-side tagging
- Google: Server-side tagging APIs
- Google: Consent mode reference
- Google: Implement consent mode with server-side Tag Manager
- Google: Consent mode overview for EEA and UK traffic
- Google Analytics: Best practices to avoid sending PII
- Google Analytics: User-provided data collection policy
- FTC: No, hashing still doesn’t make your data anonymous
Want your enrichment pipeline reviewed before you scale ad spend? Book a free server-side tracking audit or test your container locally with our GTM Container JSON Auditor.
Free Tracking Audit
Want Me to Audit Your Conversion Tracking Stack?
Book a free tracking audit. I'll review your GTM, GA4, Server-Side Tracking, Meta CAPI, Google Ads Enhanced Conversions, and Consent Mode V2 setup and highlight exactly what to fix.