We’re upgrading our email infrastructure — for immediate response, email andrewjgaber@gmail.com meanwhile.
Skip to main content
Part of Digital Empire
Meta / Facebook

Meta CAPI (server-side) with checkout.liquid dependency

Meta / Facebook · Web Pixels API replacement · confidence: high

Dies 2026-08-26

Paste-ready snippet
// This pattern covers stores where server-side Conversions API (CAPI) is
// already wired up correctly, but the BROWSER-side event_id used for
// deduplication was generated inside checkout.liquid — that generator dies
// Aug 26. CAPI itself (your server -> Meta call) is unaffected; only the
// client-side half of the dedup pair needs to move.
analytics.subscribe('checkout_completed', (event) => {
  const { checkout } = event.data;
  if (!checkout) return;

  // checkout.token is a stable, unique identifier for this checkout — use it
  // as the shared event_id on BOTH the browser pixel call and your existing
  // server-side CAPI call for the same order, exactly as the old
  // checkout.liquid-generated ID was used.
  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: 'Purchase',
        event_time: Math.floor(Date.now() / 1000),
        event_id: checkout.token,
        action_source: 'website',
        custom_data: {
          value: checkout.totalPrice ? checkout.totalPrice.amount : undefined,
          currency: checkout.totalPrice ? checkout.totalPrice.currencyCode : undefined,
          order_id: checkout.order ? checkout.order.id : undefined,
        },
      }],
    }),
  });

  // Your existing order-webhook-triggered server-side CAPI call must be
  // updated to pass this SAME checkout.token (or the resulting order ID) as
  // its event_id — that is the change needed on the server side, no code
  // shown here since it lives in your own backend, not the pixel.
});

Legacy pattern detected via: fbq\(\s*['"]init['"][\s\S]{0,400}checkout\.liquid|eventID\s*[:=][\s\S]{0,80}checkout

What this does NOT cover

This does NOT cover CAPI payload fields sourced from Additional Scripts (e.g. a custom customer match key set there) — audit your server-side payload builder separately.

Test-event verification checklist

  • Browser-side event_id (checkout.token) and server-side CAPI event_id resolve to the same value for the same order — verify in Events Manager "Test Events" that browser + server events show as one deduplicated event, not two.
  • checkout.order.id is available on checkout_completed (it is null on all earlier checkout events) — safe to read here, not on checkout_started.
  • Server-side CAPI call itself is untouched by this snippet — this only fixes the client-side half of the dedup ID that used to be minted in checkout.liquid.
  • Verify live against the platform's own test-event tool: https://developers.facebook.com/tools/events_manager/test_events/