- Build in this order: access token, first event, event identifier (ID) for deduplication, then Google. Test each step before you move on.
- Meta requires three fields on every website event sent through CAPI: action_source, event_source_url and client_user_agent. Add event_id too, so Meta can deduplicate.
- With Meta's recommended method, Meta deduplicates a browser event and a server event when the event name and the event ID match and both arrive within 48 hours.
- Events sent with a test code still flow into Events Manager. Test with a team member's details, never a patient's.
- If you upload Google enhanced conversions with the Google Ads API, add an order ID to your conversion tag and upload within 24 hours. The diagnostics report is ready in about 72 hours.
- Event Match Quality is a diagnostic. Do not add identifiers only to raise the score.
19 min read · Pillar: Digital Health Performance Marketing · Implementation Guide
Moving tracking to the server is easy to say and hard to finish. Teams get stuck on small things: a missing field, an event ID that does not match, a test code left in production. This guide is the hands-on version. It shows you how to set up Meta’s Conversions API (CAPI) and Google’s enhanced conversions, step by step, and how to test each part before you trust the numbers.
CAPI means your server sends a conversion event, such as a contact form request, straight to Meta instead of relying only on the visitor’s browser. Enhanced conversions add first-party customer details, in hashed form, to a Google Ads conversion you already measure. Meta’s Conversions API is an API (Application Programming Interface), which is a way for two systems to talk to each other. Google enhanced conversions can use one too, but you can also set them up with the Google tag or Google Tag Manager. The Meta Pixel is the code on your site that sends events from the visitor’s browser. This is a working guide, not legal advice. Teams that handle patient information must also think about HIPAA (the Health Insurance Portability and Accountability Act).
This guide is about setup and testing. It is not about policy. For what you can and cannot send, start with our guide to server-side HIPAA attribution for digital health. That post and our practical guide to digital health marketing and HIPAA are audit lists. They tell you what to check. This guide is a walkthrough. It tells you what to click, what to send and how to prove it works.
What You Are Setting Up
You are setting up two separate things. They use different keys to match an event to an action, so keep them apart in your notes.
| Meta Conversions API (CAPI) | Google enhanced conversions | |
|---|---|---|
| Where you set it up | Events Manager, on your Pixel: Settings, then Conversions API | Google Ads: Goals, Settings, then Enhanced conversions |
| What you need first | Pixel ID, a Meta Business Suite, and a person with developer privileges | Accepted customer data terms, plus the URL and trigger where your conversion tag fires |
| How the platform matches the action | Same event name and same event ID from the browser and the server | Order ID on your tag, when you upload data with the Google Ads API |
| What you must send | action_source on every event. event_source_url and client_user_agent on website events | At least an email, or a first name, last name, postal code and country. A phone number can go with them |
| Where you test | Test Events tab, with a test code | Chrome Developer Tools, then the Diagnostics report |
| When you can check | Within 20 minutes in Events Manager | Diagnostics report after about 72 hours |
Before You Start
Get these ready first. Each one removes a common reason for a stalled setup.
- Your Pixel ID and a Meta Business Suite. Meta says you need both to use CAPI.
- A person with developer privileges for the business. Only those users see the Generate access token link.
- A written event list. One row per event: its name, the page it fires on and the fields it sends. This is also your checklist for the test log later.
- Google Ads access to accept the customer data terms. Know the exact URL where your conversion tag fires and what triggers it, such as a form submit.
- A safe place to test. A staging site, or a test page that no patient uses.
- A decision on how you will send events. Directly from your server, through a partner tool, or through server-side Google Tag Manager.
Part 1: Set Up Meta CAPI Step by Step
Step 1. Choose how you will send events
Meta lists several ways to connect to CAPI. They vary by effort, cost and features. Meta’s own developer guide focuses on direct builds, and it also has a guide for server-side Google Tag Manager. Pick one method and name an owner. The steps below show a direct build, because the same fields apply to every method.
Meta may place a health-related website or app in a data sharing category with extra limits. Meta’s own names are Core Setup, restriction on certain standard events, and full restrictions. They limit what you can send, such as custom parameters and parts of the page URL, and which events you can use. We cover that in Meta’s new data restrictions. Check which limit applies to your data source in Events Manager before you pick event names.
Step 2. Create the access token
- In Events Manager, choose your Pixel.
- Open the Settings tab.
- Find the Conversions API section.
- Under Set up manually, select Generate access token and follow the pop-up.
Only users with developer privileges see that link. If you cannot see it, ask an admin to do this step or to change your role. You pass the token in every API call. Our advice: store it with your server’s secret settings, never in page code.
Step 3. Send your first event
Send a POST request (a way to send data to a web address) to your Pixel’s events address:
https://graph.facebook.com/{API_VERSION}/{PIXEL_ID}/events?access_token={TOKEN}
Here is a minimal website event. Replace the placeholders. It uses a generic event name and a generic page, on purpose.
{
"data": [
{
"event_name": "Lead",
"event_time": 1796292000,
"event_id": "lead-20261203-0001",
"event_source_url": "https://www.example.com/contact/",
"action_source": "website",
"user_data": {
"client_ip_address": "203.0.113.10",
"client_user_agent": "Mozilla/5.0 (example user agent)"
}
}
]
}
A real event usually also carries the fbp and fbc browser values. Send event_time as a Unix timestamp in seconds. Replace the sample number with the current time. The time can be up to 7 days old. If any event in the request is older than 7 days, Meta returns an error for the whole request and processes none of the events. You can send up to 1,000 events in one request, but Meta recommends sending each event as it happens.
Step 4. Check the required fields
action_sourceis required on every event. Usewebsitefor a conversion on your site. Usephone_callfor a booking made by phone. By using CAPI, you tell Meta this value is accurate.event_source_urlis required on website events. It is the page URL where the event happened, and it should match your verified domain.client_user_agentis required on website events. Never hash it. Browsers add it on their own, but your server must add it by hand.client_ip_addressshould be the visitor’s real address, not your server’s. Never hash it.event_idis optional in the API, but Meta recommends it on every event. Step 5 explains why.
Meta also recommends external_id. Decide that one with your privacy officer before you add it.
Step 5. Add event IDs and deduplicate
If you send the same event from the browser Pixel and from your server, Meta needs a way to count it once. Use the event name and the event ID.
In the browser, add the ID as the fourth argument of the Pixel call:
fbq('track', 'Lead', {}, {eventID: 'EVENT_ID'});
Then follow these rules:
- The Pixel’s
eventIDmust match the server’sevent_id. - The Pixel’s event name must match the server’s
event_name. - Both events must go to the same Pixel ID.
- Meta only deduplicates when both events arrive within 48 hours of each other.
- Make the ID unique for each action. An order number or a form submission ID works. If the action has no ID of its own, a random number works, as long as the browser and the server send the same one.
- Meta generally keeps the first event it receives. If a server event and a browser event arrive within about 5 minutes of each other, Meta favors the browser event.
- If you send an event only from the server, you do not need deduplication for it.
Meta recommends sending the same events from both the Pixel and CAPI. Whether the browser Pixel runs on a given page is a policy call. Use the callout above for that.
Step 6. If you use server-side Google Tag Manager
Meta has a guide for the CAPI tag in server-side Google Tag Manager. Add event_id as a parameter in the Meta tag. Use the same event ID variable your Pixel tag uses. Test in Tag Manager’s preview mode, and add your Test Events code to the tag while you test. Remove the code before you publish.
Part 2: Set Up Google Enhanced Conversions Step by Step
Step 1. Check eligibility and accept the terms
First check each conversion against Google’s customer data policy. The callout above explains where to read more. Then, in Google Ads:
- Open Goals, then Settings.
- Expand Enhanced conversions.
- Check Turn on enhanced conversions.
- Read and agree to the customer data terms.
Since April 2026, Google has combined enhanced conversions for web and for leads into one setting. Conversions you import from Google Analytics goals are not supported. Use a Google Ads conversion action with the Google tag or Google Tag Manager instead.
Step 2. Choose how the data reaches Google
You can use the Google tag, Google Tag Manager or the Google Ads API. Since April 2026, Google Ads accepts data from tags and from the API at the same time. Google’s help page for the Google tag still warns that data sent a different way than the method selected in Google Ads may not be processed. Our advice: pick one method for each conversion action and name an owner.
With the Google tag you have three ways to collect data: automatic detection, Cascading Style Sheets (CSS) selectors or JavaScript variables, or a code snippet. Automatic detection inspects the page for strings that match. Automatic detection reads the whole page, so it can pick up fields you did not plan to send. On a health site, choosing the fields yourself with selectors or the snippet gives you more control.
Step 3. Send the right customer fields
Google needs at least one of these:
- An email address (preferred).
- A first name, last name, postal code and country.
- A phone number, sent together with an email or with a full name and address.
You can send plain values and let Google hash them, or send values you hashed yourself. If you hash them yourself, trim spaces, make text lowercase, and write phone numbers in the international E.164 format. That means 11 to 15 digits including a plus sign and the country code, with no dashes, parentheses or spaces. Remove any periods before the domain in gmail.com and googlemail.com addresses. Then hash with SHA-256 (Secure Hash Algorithm 256) and send the result in hexadecimal form.
Step 4. If you upload with the Google Ads API, add an order ID
When you send data through the Google Ads API, the website tag sends only the Google click ID (GCLID) and an order ID. You send the hashed customer data later. Google matches the two by the order ID.
- Add a transaction ID, also called an order ID, to your website conversion tag. Make it unique for each conversion.
- Upload the hashed data within 24 hours of the conversion. Google suggests finishing several minutes before the 24 hours end.
- The conversion action must be at least 6 hours old before you upload to it.
- Send the GCLID with the upload when you have it. Google does not support enhanced conversions for web when a click carries a
gbraidorwbraidvalue (other Google click IDs) instead of a GCLID.
Step 5. Preview, then go to production mode
If you route through server-side Google Tag Manager, select Preview in the server container. You will see each incoming request, the client that claimed it, the outgoing requests to vendors and the tags that fired. Before you send real traffic, Google strongly recommends installing the server on your own first-party domain and upgrading it to production mode.
Part 3: Test Everything and Keep a Test Log
Use details from your own team for tests. Meta says test events may be discarded if they do not match a Meta account, so its own advice is to use your own details. Meta also says events sent with a test code are not dropped. They flow into Events Manager and are used for targeting and measurement. Never use a patient’s details, and do not test on a page patients use.
Test Meta with the Test Events tool
- In Events Manager, go to Data Sources, choose your Pixel, then open Test Events. Copy the test code.
- Add
"test_event_code": "YOUR_CODE"at the top level of your request, next todata. - Send one event from the browser and one from the server. Use the same event name and the same event ID.
- Watch the Test Events window. You should see both events, and which one was processed and which was deduplicated.
- Read the raw payload your server sent. Check the event name, the page URL and every custom field for health words.
- Remove the test code. Meta says it is for testing only.
- Send a normal event without the code. It should show in Events Manager within 20 minutes.
Test Google with Chrome Developer Tools
- Complete a test conversion on your staging site.
- Right-click the page, select Inspect, then open the Network tab.
- Type “google” in the search bar.
- Find the request to
googleadservices.com/pagead/conversion/, orgoogle.com/pagead/1p-conversion/in some browsers. - Open the Payload tab and look for an
emparameter that starts withtv.1~emand is followed by a long string. - If you see only
tv.1~emwith no long string, the parameter is empty. The customer data was not available when the tag fired. - About 72 hours later, open Goals, then Summary, choose the conversion action and select Diagnostics. About 30 days after a successful setup, impact results appear in your conversion action table.
Your test log
Copy this table into a shared sheet. Fill it in each time you change anything.
| Test | What you should see | Result (pass or fail) | Date and tester |
|---|---|---|---|
| 1. Browser event with an event ID | Appears in Test Events | ||
| 2. Server event with the same name and ID, plus the test code | Appears in Test Events, and one of the pair is marked deduplicated | ||
| 3. Raw server payload | No health words in the event name, page URL or custom fields | ||
| 4. Test code removed, normal server event sent | Shows in Events Manager within 20 minutes | ||
| 5. Google conversion tag on the staging page | Request to googleadservices.com has an em value with a long string after tv.1~em | ||
| 6. Google Diagnostics, about 72 hours later | No alerts for the conversion action | ||
| 7. API upload only: order ID on the tag matches the upload | No order ID mismatch alert, and no API errors |
Part 4: Troubleshooting
Meta events do not show up
- Check the test code. In the server-side Tag Manager debugger, if the tag shows Fired: Succeeded, open the tag and confirm the test code is right. Then restart preview mode.
- Read the error. If the tag shows Fired: Failed, open the Request tab, select the outgoing request to
graph.facebook.comand read the response body. - Check the Pixel. Look at the Pixel that matches the Pixel ID in your request.
- Check the date. One event older than 7 days makes the whole request fail.
- Check the required fields.
action_sourceon every event.event_source_urlandclient_user_agenton website events. - Wait. Meta says events should show within 20 minutes of sending.
- Check the token link. If you cannot see Generate access token, you may lack developer privileges.
- Check your firewall. If your business uses a firewall for outbound requests, Meta publishes the addresses its systems use. Check that list.
Events are counted twice, or the deduplication rate is low
Open the Event Deduplication tab for the event. Meta shows the share of events deduplicated from each source and warns you when it is too low. Our guide to optimizing digital health ads uses a rate above 90 percent as a working benchmark. Work through this list:
- Do the browser and server send the exact same event name?
- Does the browser
eventIDequal the serverevent_id, character for character? - Is every ID unique per action? Reused IDs make separate actions look like one.
- Do both events go to the same Pixel ID?
- Do both arrive within 48 hours of each other?
- Does one source send IDs and the other send none? Meta says low Overlap means non-unique IDs, or IDs that come from only one source.
- Are you deduplicating with
fbporexternal_idinstead? Meta says that method mostly works for a browser event followed by a server event, and a server event is not discarded if no browser event arrived in the past 48 hours. - Does your browser conversion fire on a thank-you page view? On Episode 10 of the Marketing Digital Health podcast, Marina Alves, technical lead at Matchnode, said: “When you’re using page views, for example, too, if someone submits the form, gets to that confirmation thank you page, and then they for some reason reload that page, that could count that form submission twice if we use a page view.” She said that “tracking the form submission specifically instead of a confirmation page view is best practice.” She also said that sometimes it is not possible. Check your tag trigger, then test again.
Event Match Quality is low
Event Match Quality (EMQ) is Meta’s score, from 1 to 10, for how well your server event’s customer details may match a Meta account. Treat it as a diagnostic. Our guide to optimizing digital health ads lists 7.0 or higher as a benchmark. Meta’s own guidance is to aim for 6.0 or higher. Use a low score as a reason to look for mistakes. Do not use it as a reason to add identifiers you would not otherwise send.
Event Match Quality fix list: work down this list before you change anything else
Use the visitor’s real IP address, not your server’s. Meta says sending both may help event matching.
Send them unchanged and refresh them regularly. They are Meta’s browser ID and click ID cookie values.
Trim spaces and make emails lowercase. Write phone numbers with the country code and no symbols.
Events that carry only broad fields, such as city, state, zip code and gender, or date of birth with user agent, are invalid.
Click the Event Match Quality score for the event and read Meta’s recommendations.
Do we already hold it in a flow our privacy officer has approved? If not, leave it out. A low score is not a reason to send more.
Sources: Meta Conversions API, Best Practices and Customer Information Parameters. Step 6 is Matchnode’s own advice.
Google enhanced conversions errors
| What you see | Likely cause | What to do |
|---|---|---|
| CUSTOMER_NOT_ACCEPTED_CUSTOMER_DATA_TERMS | The customer data terms are not accepted for this account | Accept them in Google Ads: Goals, Settings, Enhanced conversions |
| CONVERSION_ACTION_NOT_ELIGIBLE_FOR_ENHANCEMENT | Enhanced conversions is not turned on for that conversion action | Check Turn on enhanced conversions on the conversion action |
| CONVERSION_ALREADY_ENHANCED | The same order ID was uploaded twice for that conversion action | Send a unique order ID for each conversion |
| INVALID_USER_IDENTIFIER | A hashed field is not a valid 64-character SHA-256 hexadecimal value | Normalize first, then hash. Re-run the upload |
| TOO_RECENT_CONVERSION_ACTION | The conversion action is less than 6 hours old | Wait until it is at least 6 hours old, then upload |
| Order ID mismatch alert in Diagnostics | The order ID on the tag and the order ID in the upload do not match, or the tag sends none | Send the same transaction ID in both places |
| em shows only tv.1~em in Developer Tools | The parameter is empty. Customer data was not on the page when the tag fired | Make the data available before the tag fires |
| API route: enhanced conversions not applied to some clicks | The click carried a gbraid or wbraid value (other Google click IDs) instead of a GCLID | This is a Google limit, not a setup error. Plan for it |
Part 5: Weekly Monitoring
Setup is not the finish line. Put these checks on a weekly calendar and give each one an owner. Also compare platform numbers with your own records, such as booked appointments in your scheduling system. For which numbers to track, see digital health marketing metrics.
| Check | Where to look | What good looks like | How often |
|---|---|---|---|
| Events received | Events Manager, your Pixel, Overview | Counts look normal for your traffic. Connection Method shows both Browser and Server if you use both | Weekly |
| Event freshness | Overview, Event Details, Event Freshness tab | Average delay stays close to real time | Weekly |
| Deduplication | Event Details, Event Deduplication tab | No low-rate warning. Our benchmark is above 90 percent | Weekly |
| Event Match Quality | Overview, then click the score | Score is steady. Read Meta’s recommendations. Do not add identifiers only to raise it | Weekly |
| Google diagnostics | Goals, Summary, your conversion action, Diagnostics | No alerts. If you use the API, check offline data diagnostics too | Weekly |
| Platform numbers versus your records | Your scheduling system or customer relationship management (CRM) system | Booked appointments are close to platform conversions, and you can explain any gap | Weekly |
| Rules and changes | Meta Business Tools Terms and Google customer data policy | Reviewed, and your event list still fits. Review again when you add an event, form or vendor | Monthly, and at every change |
Need a Second Set of Eyes?
Matchnode defaults to Ours Privacy, a customer data platform (CDP) built for HIPAA, for server-side setups.
If you would like help with your setup or your test log, see our technical services or contact Matchnode.
Sources: Meta Conversions API documentation (Get Started, Using the API, Server Event Parameters, Customer Information Parameters, Handling Duplicate Events, Verifying Setup, Best Practices, and the guide for server-side Google Tag Manager); Google Ads Help (set up enhanced conversions for web using the Google tag); Google Ads API documentation (manage online click conversions); Google Tag Manager server-side documentation (introduction, and preview and debug). Benchmarks marked as ours come from Matchnode’s guide to optimizing digital health ads.