Meta / Facebook · Web Pixels API replacement · confidence: high
Not deadline-gated — duplicate-firing / hygiene fix
analytics.subscribe('product_added_to_cart', (event) => {
const { cartLine } = event.data;
if (!cartLine) return;
const value = cartLine.cost.totalAmount.amount;
const currency = cartLine.cost.totalAmount.currencyCode;
const variant = cartLine.merchandise;
fetch(`https://graph.facebook.com/v20.0/PIXEL_ID/events?access_token=ACCESS_TOKEN`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
keepalive: true,
body: JSON.stringify({
data: [{
event_name: 'AddToCart',
event_time: Math.floor(Date.now() / 1000),
action_source: 'website',
custom_data: {
value,
currency,
content_ids: variant && variant.id ? [variant.id] : [],
content_type: 'product',
contents: [{ id: variant && variant.id, quantity: cartLine.quantity }],
},
}],
}),
});
});What this does NOT cover
What this does NOT cover: server-side Conversions API dedup for AddToCart — only the browser-side pixel call is replaced here, and a matching CAPI event must be verified independently. It also does not cover ViewContent or other funnel-stage Meta events, which each need their own migration snippet.
Meta / Facebook family · Meta Pixel + Meta CAPI + Meta Ads post-purchase — Aug 26 breakage is same across all.