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 Pixel fbq('track', 'InitiateCheckout') in Additional Scripts

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

Dies 2026-08-26

Paste-ready snippet
analytics.subscribe('checkout_started', (event) => {
  const { checkout } = event.data;
  if (!checkout) return;

  const value = checkout.totalPrice ? checkout.totalPrice.amount : undefined;
  const currency = checkout.totalPrice ? checkout.totalPrice.currencyCode : undefined;
  const numItems = checkout.lineItems.reduce((sum, item) => sum + item.quantity, 0);

  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: 'InitiateCheckout',
        event_time: Math.floor(Date.now() / 1000),
        event_id: checkout.token,
        action_source: 'website',
        custom_data: { value, currency, num_items: numItems },
      }],
    }),
  });
});

Legacy pattern detected via: fbq\(\s*['"]track['"]\s*,\s*['"]InitiateCheckout['"]

What this does NOT cover

What this does NOT cover: repeated or abandoned checkout attempts by the same shopper — Shopify can fire checkout_started more than once per session, and this snippet does not dedupe across attempts. It also does not cover server-side CAPI InitiateCheckout dedup logic, which must be verified against the shared event_id independently.

Test-event verification checklist

  • Fires when checkout_started fires: first checkout entry for classic checkout, every checkout entry for Checkout Extensibility shops (per Shopify docs — verify which applies to the target store).
  • event_id uses checkout.token so this dedupes against a server-side InitiateCheckout CAPI call for the same checkout session.
  • value/currency read from checkout.totalPrice at the moment checkout starts, not the cart total (they can differ once shipping/tax are estimated). Does not fire on every cart-page visit — only on actual checkout entry.
  • Verify live against the platform's own test-event tool: https://developers.facebook.com/tools/events_manager/test_events/

Related paste-ready snippets

Meta / Facebook family · Meta Pixel + Meta CAPI + Meta Ads post-purchase — Aug 26 breakage is same across all.