Skip to main content

Meta Conversions API (CAPI) Integration

Synchronize client-side Meta Pixels and server-side Conversions API (CAPI) pipelines with cryptographic consent state hashing, real-time pixel suppression, and California Limited Data Use (LDU) flags.

CIPA ยง 631

Pixel Interception

Blocks fbq('track', ...) and pre-consent image beacons from sending unhashed PII before explicit user opt-in.

LDU SYNC

Limited Data Use

Automatically injects ['LDU'] data processing options for California visitors who opt out under CCPA/CPRA.


Step 01: Client-Side Pixel Guardโ€‹

Add Consent Shield before your Meta Pixel snippet. Consent Shield will automatically wrap window.fbq and prevent event transmission until marketing consent is verified:

<!-- 1. Consent Shield Defense Kernel -->
<script
src="https://consentshieldai.com/shield.js"
data-site-id="CS-LIVE-PROD"
data-cipa-protect="true"
async>
</script>

<!-- 2. Meta Pixel Code -->
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('init', 'YOUR_PIXEL_ID');
fbq('track', 'PageView');
</script>

Step 02: Server-Side Meta CAPI Payload Formattingโ€‹

When forwarding backend conversion events to Meta Graph API (https://graph.facebook.com/v19.0/{pixel_id}/events), include the data_processing_options parameter when the visitor is from California and has not granted marketing consent:

{
"data": [
{
"event_name": "Purchase",
"event_time": 1723500000,
"action_source": "website",
"user_data": {
"em": ["f660ab912ec121d1b1e928a0bb4bc61b15f5ad44d5efdc4e1c92a25e99b8e44a"],
"client_ip_address": "192.0.2.1",
"client_user_agent": "Mozilla/5.0..."
},
"custom_data": {
"currency": "USD",
"value": 149.00
},
"data_processing_options": ["LDU"],
"data_processing_options_country": 1,
"data_processing_options_state": 1000
}
]
}

Step 03: Event Deduplication & Audit Hashโ€‹

To maintain 100% conversion accuracy across browser and server without double counting, pass the Consent Shield proof_id as the Meta event_id:

// Browser trigger
const eventId = window.ConsentShield.exportAuditHash();
fbq('track', 'Purchase', { currency: 'USD', value: 149.00 }, { eventID: eventId });

Verify Meta Pixel Wiretap Protection

Scan your checkout and lead forms for pre-consent Meta pixel leaks subject to California ยง 631 statutory damages.