Shopify7 min read10 views

Shopify Facebook Pixel InitiateCheckout with GTM

Track Shopify checkout starts through Customer events and GTM. Replace button-click tracking and test the Meta InitiateCheckout payload.

Watch on YouTube

The short answer

Track Shopify checkout starts by subscribing to checkout_started in Customer events and sending Meta InitiateCheckout through GTM. Shopify documents this eventshopify.dev on checkout entry, including repeat entries with Checkout Extensibility. This guide helps store owners and implementers replace cart-button tracking and compare the checkout amount with the received event.

  • Shopify event: checkout_started; GTM trigger: custom_begin_checkout.
  • Meta event: InitiateCheckout; value uses the checkout subtotal.
  • If the Meta app already sends checkout events, inspect it first.
  • Steps and settings checked against linked documentation and tutorial files on 25 October 2026.

Ask an assistant

ChatGPTClaudePerplexity

FREE AUDIT

NO LOGIN

Check what Meta and Google can count on your site

  1. Your site
  2. Crisper
  3. Meta and Google count it

Enter your website to see how good its tracking is, and whether Meta is likely restricting it.

Run a free audit

The video shows the older cart-button listener; the written steps below use Shopify Customer events to observe checkout entry.

How do I load GTM for Shopify checkout tracking?

Use a custom pixel in Customer events, with the GTM loader and checkout subscription together.

Use this custom path when you need to maintain your own InitiateCheckout mapping. Inspect the connected pixel in Facebook and Instagram by Metahelp.shopify.com first; Shopify warns about duplicate reporting from overlapping installations. Use a development store and test container for this guide.

1. Create a custom pixel in the development store

  1. Open Settings > Customer events.
  2. Name the pixel and choose Add pixel.
  3. Review Customer privacy against the store's consent plan using Shopify's permission and data-sale settingshelp.shopify.com.

Done when the editor is open and its privacy settings match the intended test behavior.

2. Load the test GTM container

  1. Copy the GTM head snippet, following Shopify's GTM custom pixel examplehelp.shopify.com.
  2. Remove its HTML script tags.
  3. Use the ID of a test container that only your development store loads.
  4. Keep the loader and the subscription below in the same custom pixel.

Done when the editor contains JavaScript for the intended container and no surrounding HTML script tags.

Should PageView use the checkout trigger?

No. Keep the storefront PageView sender separate and give InitiateCheckout only the custom_begin_checkout trigger. The Shopify PageView guide covers theme-based page tracking; it does not replace the custom-pixel loader used here.

Why replace the Shopify checkout button listener?

A cart-button click records an attempt to navigate. Shopify's checkout_started eventshopify.dev records entry into checkout, including each entry on Checkout Extensibility. Use that boundary when you want to measure checkout starts.

Where should I initialize the checkout data layer?

Initialize window.dataLayer in the same custom pixel as the loader, as in Shopify's GTM examplehelp.shopify.com. The first line of the subscription below preserves an existing array; no Liquid head snippet is needed.

What code sends the checkout data to GTM?

Subscribe to checkout_started and map its checkout payload. The event referenceshopify.dev supplies subtotalPrice, currencyCode and lineItems. A subscription callback is the function run when that event arrives.

3. Append the checkout subscription

  1. Place the JavaScript below after your GTM loader in the custom pixel.
javascript28 lines
// Append once after the GTM loader in the same custom pixel.window.dataLayer = window.dataLayer || [];analytics.subscribe("checkout_started", (event) => {  const checkout = event.data.checkout;  const amount = checkout.subtotalPrice?.amount;  const currency = checkout.currencyCode;  if (amount == null || !Number.isFinite(Number(amount)) || !currency) {    throw new Error("InitiateCheckout mapping needs subtotal and currency");  }

19 more lines of JavaScript

  • Copy and download
  • Emailed to you

Unlock this snippet

Three details, and the full code is yours

No account needed. Unlock once and every snippet on the blog opens.

We email you a copy. We may follow up on WhatsApp.

Done when the saved editor has one checkout_started subscription and pushes custom_begin_checkout.

This value uses subtotalPrice.amount, which Shopify defines as the price before duties, shipping and taxesshopify.dev. The previous cart script summed item prices; compare discounted test carts before interpreting old and new totals as equivalent.

Shopify's checkout line-item definitionshopify.dev allows variant: null. The snippet skips items without a variant ID while keeping the checkout event and subtotal. Check a local test payload containing one valid variant and one null-variant line. Done when the push keeps the original value and currency, includes the valid item, and contains no item with a missing ID.

Should I put this code in theme.liquid or Additional Scripts?

Put this subscription in Customer events. Shopify has retired checkout.liquid and Additional Scripts on Thank you and Order status pagesshopify.dev; neither those fields nor a theme render statement belongs in this custom-pixel editor.

How do I replace the old checkout snippets?

Prepare the replacement in the development store and identify the old sender before connecting it.

Migration. Record the old event contract

  1. Record every tag that listens for custom_begin_checkout.
  2. Compare its fields with the new snippet.
  3. Retire the old click listener in the test setup when the replacement is connected.

Done when one source sends the checkout event and the downstream variables read the new payload.

How do I configure the Meta InitiateCheckout tag?

Map custom_begin_checkout to Standard > InitiateCheckout in the Meta Pixel templateraw.githubusercontent.com. Keep the trigger name separate from the Meta name. A trigger tells GTM when to run a tag.

4. Create the variables and event tag

Each Data Layer Variablesupport.google.com reads one named value from the event.

  1. Create a Version 2 Data Layer Variable for each path in the table below.
  2. Create the Meta tag with Standard > InitiateCheckout and enter your pixel ID.
  3. Under Object Properties, map value and currency.
  4. Map event_id to Event ID.
  5. Leave automatic ecommerce mapping off.
  6. Attach a Custom Event trigger matching custom_begin_checkout exactly.
  7. Clear the template's Opt in to a Meta-enabled Conversions API integration boxraw.githubusercontent.com. It is ticked by default, and while it is ticked the tag opts the pixel in to that integration. This guide sets up the browser tag only, so clear it on this tag and on any other Meta Pixel tag that uses the same pixel.
  8. Save the tag.

value

Data layer path
ecommerce.value

currency

Data layer path
ecommerce.currency

Event ID field

Data layer path
event_id
These paths match the subscription in this guide.

Done when reopening the tag shows InitiateCheckout, the intended pixel ID, both properties, the Event ID variable, the custom_begin_checkout trigger and the opt-in box cleared.

The snippet also preserves item details for your other mappings. It does not define a catalog ID convention; compare any existing catalog mapping before adding contents or content_ids to this tag.

How do I test Shopify InitiateCheckout?

Use Shopify Pixel Helperhelp.shopify.com to inspect the source event, then check InitiateCheckout in Meta Events Manager. A green helper status means the subscribed code ran without an error; keep the destination field check separate.

5. Publish the version in the test container

Changes saved in a workspace do not run yet. Google sayssupport.google.com you need to publish workspace changes to make them operational.

  1. Open the test container that only your development store loads.
  2. Select Submit, then choose Publish and Create Version.
  3. Name the version and publish.

Do not publish to a container your live store loads; move the tested setup there through your normal release process.

Done when the test container's Versions list shows your version as published and the pixel code loads that container's ID.

6. Connect the pixel and run its test

  1. Save the pixel.
  2. Select Connect in the development store.
  3. Choose Test, following Shopify's test procedurehelp.shopify.com.
  4. Exercise the consent flow.
  5. Enter checkout with a populated test cart.

Done when Pixel Helper shows checkout_started with the fields you expected and no execution error.

7. Compare the event received by Meta

  1. Open the intended pixel's Test Events in Events Manager.
  2. Find InitiateCheckout from the same test action.
  3. Compare the subtotal and currency with checkout.
  4. Return to the cart and enter checkout again to test the documented repeat-entry behavior.
  5. Record the time, source fields and destination fields.

Done when the received event matches the action and there is no unexplained second sender.

Shopify says Tag Assistant's Troubleshoot tag feature is incompatible with custom pixelshelp.shopify.com. Use Pixel Helper and the destination checks for this sandboxed setup.

Why can checkout events be missing or duplicated?

Inspect the source before changing the tag. This guide is for a custom checkout mapping, not a reason to add another sender beside a working app integration.

  • Listening only on cart buttons: other checkout entry paths are outside that listener. Test the entry paths your store offers.
  • Expecting a unique order count: checkout starts can repeat on re-entry. Keep these events separate from Purchase.
  • Mapping a stale cart value: discounts may change the subtotal. Compare the received checkout payload with the checkout screen.

What should I track after InitiateCheckout?

Use the Shopify Purchase guide to check completed orders after checkout starts are verified.

What changed in this guide

  • 25 October 2026: Replaced the cart-button listener with checkout_started in Customer events while preserving custom_begin_checkout. Defined subtotal value, repeat-entry behavior and the retirement of legacy checkout script locations. Added isolated test-container publication before testing and explicit Meta-enabled Conversions API opt-out checks. Skipped checkout items without variant IDs and added a null-variant completion check.

Sources

9 sources
  1. 1Shopify documents this event↩
  2. 2Facebook and Instagram by Meta↩
  3. 3Shopify recommends reviewing available pixel apps before custom code↩
  4. 4Shopify's permission and data-sale settings↩
  5. 5Shopify has retired checkout.liquid and Additional Scripts on Thank you and Order status pages↩
  6. 6Meta Pixel template↩
  7. 7Data Layer Variable↩
  8. 8Shopify Pixel Helper↩
  9. 9Google says↩