How to Track Purchases in Google Analytics 4

Cody Schneider8 min read

Setting up purchase tracking in Google Analytics 4 can feel like a final boss battle, but it's the only way to know if your marketing efforts are actually making you money. Without it, you’re just guessing which ads, emails, or social posts are driving sales. This guide will walk you through setting up GA4 ecommerce tracking, from the simple one-click integrations on popular platforms to the more hands-on approach using Google Tag Manager.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Why Is E-commerce Tracking So Important Anyway?

Sure, you can see total revenue in your Shopify or WooCommerce dashboard. But that doesn't tell you the whole story. Effective purchase tracking in GA4 lets you connect the dots between your marketing activities and your sales outcomes.

Proper ecommerce tracking helps you answer essential business questions like:

  • Which marketing channels are most profitable? Did that expensive Google Ads campaign generate high-value orders, or did your organic social media efforts bring in more revenue?
  • What is the real customer journey? You can see the full path a user takes before buying - from a blog post visit to an email click and finally, a purchase from a retargeting ad.
  • Which products are most popular? By tracking item-level data, you can see not just what people buy, but also what they view, add to their cart, and ultimately purchase together.
  • How effective are my promotions? With coupon tracking, you can directly measure the impact of a sale or discount code on total revenue.

In short, it moves you from simply having data to having actionable insights that can drive your business forward.

Understanding the GA4 purchase Event

Before jumping into the setup, it’s helpful to know how GA4 thinks about ecommerce. Unlike its predecessor (Universal Analytics), GA4 is completely event-based. Every user action is an "event," and a sale is just a specific, highly important event called purchase.

For GA4 to correctly process a transaction, the purchase event needs to be sent with several key pieces of information, called parameters. Some are required, while others are recommended for more detailed reporting.

The main parameters for a purchase event are:

  • transaction_id: A unique ID for the order (e.g., "ORDER-12345"). This is required to prevent duplicate transactions.
  • value: The total value of the transaction, including tax and shipping (e.g., 55.99).
  • currency: The currency of the transaction in a 3-letter ISO 4217 format (e.g., "USD").
  • items: This isn't just one value, it's an array, or list, of all the products in the order. This is a critical parameter that unlocks product-level reporting.
  • tax (Recommended): The total tax amount.
  • shipping (Recommended): The total shipping cost.
  • coupon (Recommended): The coupon or discount code used, if any.

The items array is where the real magic happens. Each item in the array has its own set of details, like item_id, item_name, price, and quantity. This is how GA4 knows you sold two blue t-shirts and one pair of red socks in a single transaction.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Method 1: The Easy Way with Platform Integrations

If you're using a major ecommerce platform, you're in luck. Most have built-in integrations or official plugins that handle all the heavy lifting for you. They automatically create the data layer and send the purchase event with all the necessary parameters to GA4 when an order is completed.

For Shopify Stores

Shopify's native integration makes this incredibly simple. You don't need Google Tag Manager or any custom code.

  1. From your Shopify admin, go to Online Store > Preferences.
  2. Scroll down to the Google Analytics section.
  3. Click Manage pixel here.
  4. Click Connect your Google account and follow the OAuth flow to connect your Google account that has access to your GA4 property.
  5. Select your GA4 property from the list and click Connect.

That's it. Shopify will now automatically send page views, product views, add to carts, and most importantly, purchase events directly to your GA4 property.

For WooCommerce (WordPress) Stores

For WooCommerce users, a plugin is the best way to go. While there are many options, a popular and robust choice is the GTM4WP plugin (Google Tag Manager for WordPress).

Here’s the general flow:

  1. Install and activate the GTM4WP plugin from your WordPress dashboard.
  2. In the plugin settings, navigate to Integration > WooCommerce.
  3. Check the box for "Track enhanced e-commerce."
  4. Go to the basic settings and add your Google Tag Manager container ID.

This plugin populates the data layer with all the required ecommerce information on the right pages. You still need to configure the tags in Google Tag Manager (which we'll cover in the next section), but the plugin takes care of the hardest part: getting the data from your website.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Method 2: Setting Up Purchase Tracking with Google Tag Manager

If you have a custom-built site or your platform doesn’t have a simple integration, Google Tag Manager (GTM) is your best friend. This process is more technical, but it gives you complete control.

The key requirement here is a data layer. Your website's developer needs to add a snippet of JavaScript code to your order confirmation page. This code contains all the transaction details and "pushes" them into the data layer, where GTM can then read them.

Here’s what your developer needs to place on the confirmation page. It should look something like this:

<script>
window.dataLayer = window.dataLayer || [],
window.dataLayer.push({
  'event': 'purchase',
  'ecommerce': {
      'transaction_id': 'T-12345',
      'value': 125.75,
      'tax': 7.50,
      'shipping': 10.00,
      'currency': 'USD',
      'coupon': 'SUMMERSALE20',
      'items': [
       {
        'item_id': 'SKU-001',
        'item_name': 'Cool Blue T-Shirt',
        'price': 49.99,
        'quantity': 1
       },
       {
        'item_id': 'SKU-002',
        'item_name': 'Classic White Socks',
        'price': 28.26,
        'quantity': 2
       }]
  }
}),
</script>

Once that code is in place, you can configure GTM to capture the data and send it to GA4. It involves three main steps.

Step 1: Create Data Layer Variables in GTM

First, you need to teach GTM how to read the information from the data layer. You do this by creating variables.

  1. In GTM, go to Variables and click New under "User-Defined Variables."
  2. Name your variable something descriptive, like DLV - ecommerce.value.
  3. Choose Data Layer Variable as the variable type.
  4. For the "Data Layer Variable Name," you'll use dot notation to access the specific piece of data. For total value, it would be ecommerce.value.
  5. Save the variable.

Repeat this process for all the data points you want to track:

  • ecommerce.transaction_id
  • ecommerce.currency
  • ecommerce.tax
  • ecommerce.shipping
  • ecommerce.items (Yes, you can pull the entire array of items into one variable!)

Step 2: Create the Trigger

Next, you need to tell GTM when to fire your tag. In this case, it’s when the purchase event appears in the data layer.

  1. In GTM, go to Triggers and click New.
  2. Name your trigger, e.g., Custom Event - purchase.
  3. Choose Custom Event as the trigger type.
  4. For the "Event name," enter purchase. This must match the event name in the data layer code exactly.
  5. Leave it set to "All Custom Events."
  6. Save the trigger.
GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Step 3: Create the GA4 Event Tag

Finally, you’ll tie it all together by creating the tag that sends the data to Google Analytics.

  1. In GTM, go to Tags and click New.
  2. Name your tag, e.g., GA4 Event - Purchase.
  3. Choose Google Analytics: GA4 Event as the tag type.
  4. For the "Configuration Tag," select your main GA4 configuration tag (the one that fires on all pages).
  5. For "Event Name," type purchase. Again, this must be the exact name Google expects.
  6. Under Event Parameters, click Add Row. This is where you'll map your GTM variables to the GA4 parameters.
  7. Under "Triggering," select the Custom Event - purchase trigger you created in the previous step.
  8. Save the tag, then click Submit and Publish your container changes.

As a final check, use GTM's Preview mode and GA4's DebugView to place a test order. You should see your tag fire on the thank you page and the purchase event show up in DebugView with all the parameter data correctly populated.

Viewing Your Data in GA4's Monetization Reports

Once data starts flowing, you won't see it in the Realtime report right away. Give it 24-48 hours to fully process and then head to your Monetization reports in GA4.

Navigate to Reports > Monetization > E-commerce purchases. Here you’ll find all your product-level data, including:

  • Views
  • Carts
  • Purchases
  • Item Revenue

The Monetization overview report will give you a high-level summary of your total revenue, number of purchasers, and trends over time.

Final Thoughts

Tracking purchases is a foundational step in building a data-driven business. Following the methods above, you can directly connect your marketing spend and effort to the revenue it generates, paving the way for smarter decisions. Whether you use a simple platform integration or roll up your sleeves with Google Tag Manager, the insights you'll gain are well worth the setup.

Once you have all of this valuable purchase data flowing into Google Analytics, the next challenge is putting it into context alongside data from your ad platforms, CRM, and email marketing tools. Manually exporting CSVs and fighting with spreadsheets to create a single report can take hours. At Graphed, we connect directly to your data sources - like Google Analytics, Shopify, and Facebook Ads - so you can skip the manual work. We let you create dashboards and get answers instantly by just asking questions, allowing you to see your full-funnel performance in seconds, not hours.

Related Articles