Skip to content
Home » Blog » How Do I Track Shopify ‘Begin Checkout’ with Google Analytics 4?

How Do I Track Shopify ‘Begin Checkout’ with Google Analytics 4?

To track Shopify ‘Begin Checkout’ with Google Analytics 4 (GA4), you can use the following steps:

  1. Set up a Custom Event in GA4:
  • Log in to your GA4 account and go to the “Events” page.
  • Click on “New Event” and enter a name for your event, such as “Begin Checkout”.
  • Under “Parameters”, add the following parameters: “value”, “currency”, “items”, “item_name”, “item_id”, “quantity”, and “price”.
  • Save the event.
  1. Set up a Tag in Google Tag Manager (GTM):
  • Create a new tag in GTM and select “Google Analytics: GA4 Event” as the tag type.
  • Enter your GA4 Measurement ID in the “Measurement ID” field.
  • Under “Event Parameters”, enter the following values:
    • “Event Name”: Enter the name of your custom event, such as “Begin Checkout”.
    • “Items”: Enter “{{Checkout Step}}.dataset.product-id” (without quotes).
    • “Item Name”: Enter “{{Checkout Step}}.dataset.product-title” (without quotes).
    • “Item Price”: Enter “{{Checkout Step}}.dataset.product-price” (without quotes).
    • “Currency”: Enter “{{Checkout Step}}.dataset.currency” (without quotes).
    • “Value”: Enter “{{Checkout Step}}.dataset.product-price” (without quotes).
    • “Quantity”: Enter “{{Checkout Step}}.dataset.quantity” (without quotes).
    • “Checkout Step”: Enter “{{Checkout Step}}.dataset.step-number” (without quotes).
  • Set the trigger for the tag to fire on “Custom Event” where the event name is “begin_checkout”.
  • Save the tag.
  1. Update the Shopify Code:
  • In your Shopify store, go to the “Online Store” section and click on “Themes”.
  • Click on “Actions” and then “Edit Code”.
  • In the “Snippets” folder, find “cart.liquid” and open it.
  • Add the following code after the cart.items loop:
<div data-event="begin_checkout" data-step-number="1" data-quantity="{{item.quantity}}" data-product-id="{{}}" data-product-title="{{item.product.title}}" data-product-price="{{item.final_price | money_without_currency }}" data-currency="{{shop.currency}}"></div>
  • This code adds a div element with the relevant product data and triggers the “Begin Checkout” event.
  • Save the changes.

Once you have completed these steps, GA4 will begin tracking ‘Begin Checkout’ on your Shopify store. You can then use this data to analyze your ecommerce funnel and optimize your website for better conversion rates.