Shopify8 min read1 view

Shopify GA4 begin_checkout tracking with GTM

Track Shopify checkout entry with Customer events and GTM, map begin_checkout items and verify the event in Shopify and GA4.

Watch on YouTube

Jump to the code

The short answer

Track Shopify checkout entry in GA4 by mapping checkout_started to a begin_checkout event in GTM. Shopify's event referenceshopify.dev says extensible checkouts emit it each time a customer enters checkout. This guide is for store owners replacing cart-button tracking with a checkout event and its item data.

  • If your app already sends begin_checkout, inspect it before adding this tag.
  • Use custom_begin_checkout for the GTM trigger.
  • Send begin_checkout as the GA4 event name.
  • Steps and settings checked against Google and Shopify documentation on 25 October 2026.

Ask an assistant

ChatGPTClaudePerplexity

FREE CALL

30 MIN

Meta stopped counting your leads? Get them counted again.

  1. Pick a time
  2. Check your Meta account with Hassan
  3. See what to do next

On a free 30-minute call, Hassan checks your Meta account with you and shows you what to do next.

Book my free recovery callFree 30-minute call with Hassan.

Not ready to talk? Run a free check

When should Shopify send GA4 begin_checkout?

Choose a test cart whose products and quantities you can recognize at checkout entry. Compare it with Shopify's checkout_started payloadshopify.dev before configuring the GA4 tag.

The video shows the older cart-button method; the written steps use Shopify Customer events.

What do I need for checkout tracking?

Use a development store with Customer events access, a test GTM container and a GA4 web stream. If the native Shopify GA4 integration already records the event correctly, another sender is the wrong fix.

How does Shopify checkout data reach GA4?

The subscription pushes checkout data into GTM's data layer, then a GA4 Event tag sends it. Shopify's GTM tutorialhelp.shopify.com documents this subscription-to-data-layer pattern.

How do I connect the GA4 web stream?

Reuse the Google tag for the intended stream.

1. Confirm the destination

Google's setup guidesupport.google.com documents the Google Analytics destination and the alternate Google tag method.

  1. Reuse the store's Google tag and GA4 web stream.
  2. For Google's alternate methodsupport.google.com, enter the stream's Measurement ID as Tag ID.
  3. Give that Google tag an Initialization trigger.

Done when the saved ID matches the intended stream.

How do I check the Google tag settings?

Compare its saved ID with the GA4 web stream and inspect a test page view. Use the Shopify page_view guide to verify the page URL before testing checkout.

Can I track checkout with a cart button click?

A cart-button listener observes the click, not checkout entry. The former snippet waited for a cart request after that click; use Shopify's checkout_started eventshopify.dev for the checkout action instead.

Where should I put the GTM loader?

Put it inside the Customer events custom pixel, together with the checkout subscription.

2. Prepare the custom pixel

  1. On a development store, open Settings > Customer events and add a pixelhelp.shopify.com.
  2. Paste the GTM head snippet without its HTML script tags, as Shopify's GTM tutorialhelp.shopify.com says.
  3. Use the ID of a test container that only your development store loads.
  4. Put the subscription below in the same pixel.
  5. Review Customer privacy permissionshelp.shopify.com against the store's consent plan.

Done when the saved pixel contains your test container ID, the subscription and the intended privacy settings.

What code sends checkout items to GTM?

Subscribe to checkout_started and map the checkout line items. The sample uses the documented checkout payloadshopify.dev rather than a cart-page button selector.

3. Add the checkout subscription

  1. Add the subscription below to the custom pixel.
  2. Save the pixel.
  3. Test the callback locally with mixed valid and null-variant lines, a null variant ID, and all-null variants.
  4. Compare discounted and bundled carts with the calculated total during testing.
javascript43 lines
window.dataLayer = window.dataLayer || []; analytics.subscribe("checkout_started", (event) => {  const checkout = event.data.checkout;  const currency = checkout.currencyCode;  if (!currency || checkout.lineItems.length === 0) {    throw new Error("Checkout mapping needs currency and source lines");  }  // Validate and total every source line before filtering item identifiers.  const value = checkout.lineItems.reduce((sum, line) => {    const quantity = line.quantity;    const amount = line.finalLinePrice?.amount;    if (amount == null || !Number.isFinite(Number(amount)) ||        !Number.isFinite(quantity) || quantity <= 0 ||        line.finalLinePrice.currencyCode !== currency) {      throw new Error("Check checkout line price, quantity and currency");    }    return sum + Number(amount);

25 more lines of JavaScript

  • Copy and download
  • Emailed to you

Unlock this snippet

Two details, and the full code is yours

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

We email you a copy.

Done when the saved subscription pushes custom_begin_checkout with items, value and currency, and in the local tests the event retains its full value and currency, every emitted item has its original variant ID, and all-null input produces an empty items array without suppressing the event.

Shopify's event referenceshopify.dev allows a null variant, variant ID or line title. This sample filters out lines without a variant ID before mapping items, and omits a missing title. Value still includes every validated source line, so item reporting is incomplete when a line is skipped.

Shopify's checkout payloadshopify.dev defines finalLinePrice as the line total after line-level discounts and makes it available with Checkout Extensibility. This sample totals all source lines for value, then divides each identified line total by quantity for its item price. Google's event referencedevelopers.google.com defines value as the sum of price times quantity, excluding shipping and tax.

This Customer events mapping replaces the old checkout-button listener. Keep a copy for comparison, but do not run both senders for the same GA4 event; Shopify's custom pixel instructionshelp.shopify.com warn about overlapping installations counting events twice.

How do I check that the subscription runs?

Use Shopify Pixel Helper on the connected development-store pixel.

4. Inspect checkout entry

  1. Connect the saved pixel on the development store.
  2. Choose Test. Shopify Pixel Helperhelp.shopify.com shows the subscribed checkout_started event and any code errors.
  3. Perform the matching store action with consent granted.

Done when that event has a green dot and its payload matches the action.

This step checks the subscription only; test GA4 receipt after publishing the debug-enabled test version below.

What does GTM need to send begin_checkout?

It needs an exact-match trigger, variables for the payload and a GA4 Event tag.

Which event name goes in the GTM trigger?

Google's data-layer guidedevelopers.google.com describes the event key that activates triggers.

  1. Enter custom_begin_checkout in the Custom Event trigger.
  2. Leave regular-expression matching off.

Done when the saved event name matches the snippet exactly.

Which parameters should begin_checkout include?

Map the checkout's items, currency and value, plus the page URL from its event context.

5. Create the field mappings

  1. Create Data Layer Variablessupport.google.com, which read named values from the data layer.
  2. Choose Version 2 for nested fieldssupport.google.com.
  3. Enter the paths below.

items

Data Layer Variable path
ecommerce.items
Check
Product objects, not a text string

currency

Data Layer Variable path
ecommerce.currency
Check
Checkout currency

value

Data Layer Variable path
ecommerce.value
Check
All source line totals, including unidentified lines

page_location

Data Layer Variable path
page_location
Check
The page URL from the event context
These paths must match the event payload.

Done when each saved variable has the correct path.

How do I configure the GA4 begin_checkout tag?

Use the standard GA4 event name, even though the internal GTM event has a custom prefix.

6. Save the GA4 Event tag

  1. Create a Google Analytics: GA4 Eventsupport.google.com tag.
  2. Enter the intended Measurement ID.
  3. Set Event Name to begin_checkout.
  4. Map each table row in Event Parameters.
  5. Attach the custom_begin_checkout Custom Event trigger. A trigger is the condition that runs a tag.
  6. Save the tag.

Done when reopening the tag shows that event name, stream, parameters and trigger.

How do I verify begin_checkout in GA4?

Match a received event to a test checkout and its items.

7. Enable debug mode and publish the test version

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

  1. Before publishing, open the GA4 Event tag in the development-only container.
  2. Add debug_mode with value true in Event Parameters, following Google's DebugView instructionssupport.google.com.
  3. Save the tag settings.
  4. Open the test container that only your development store loads.
  5. Select Submit, then choose Publish and Create Version.
  6. 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 reopening the tag shows debug_mode set to true in the published version, the test container's Versions list shows your version as published and the pixel code loads that container's ID.

8. Exercise fresh events and inspect receipt

  1. With the debug_mode test version published, perform a fresh test action.
  2. Open GA4 Admin > Data display > DebugView.
  3. Select begin_checkout and compare its parameters and items with your test action.
  4. Keep debug_mode out of the final non-test configuration.

Done when the event name, products, currency and amounts agree.

Use Shopify Pixel Helper for the subscription and GA4 DebugView for receipt. Shopify says Tag Assistant's Troubleshoot tag feature is incompatible with custom pixelshelp.shopify.com; a green Pixel Helper dot confirms local execution, not GA4 delivery.

What should I save before reviewing the setup?

Save the test event, its items and the entry paths you exercised. Test a cart checkout and any accelerated checkout route your development store supports. Done when the notes identify which paths emitted checkout_started and which still need investigation.

Why does begin_checkout fire more than once?

A new checkout entry and a duplicate sender are different cases. Shopify's referenceshopify.dev says checkout_started fires each time a customer enters an extensible checkout.

  • Running the old button listener and the new subscription creates overlapping measurements. Keep one deliberate sender.
  • Sending custom_begin_checkout to GA4 changes the event name. Keep that name in the GTM trigger and use begin_checkout in the GA4 tag.
  • Sending the last cart's data gives the wrong product list. Inspect the payload at checkout entry.

What should I track after checkout entry?

Verify the shipping and payment events, then the completed purchase. Keep the same item-ID convention in each mapping.

What changed in this guide

  • 25 October 2026: Replaced the cart-click and asynchronous cart-request method with checkout_started in Customer events; added exact GA4 mappings, re-entry behavior and separate Shopify/GA4 tests. Added null-variant and null-ID filtering without reducing event value, local null-case checks, and debug mode before the full test-container publish and fresh-event checks. Replaced the repeated opening with an event-specific test instruction.

Sources

12 sources
  1. 1Shopify's event reference↩
  2. 2Shopify's GTM tutorial↩
  3. 3Google's setup guide↩
  4. 4open Settings > Customer events and add a pixel↩
  5. 5Google's event reference↩
  6. 6Shopify Pixel Helper↩
  7. 7Google's ecommerce guide↩
  8. 8Google's data-layer guide↩
  9. 9Data Layer Variables↩
  10. 10Google Analytics: GA4 Event↩
  11. 11Google says↩
  12. 12Google's DebugView instructions↩