How to Set Up Ecommerce Goals in Google Analytics

Cody Schneider7 min read

Seeing traffic and user data in Google Analytics is great, but it's only half the story. If you run an e-commerce store, the real magic happens when you connect that traffic to actual sales and revenue. This article will guide you through setting up e-commerce goals in Google Analytics so you can finally see which marketing efforts are driving your bottom line.

GraphedGraphed

Still Building Reports Manually?

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

Watch Graphed demo video

Why Ecommerce Tracking in Google Analytics is a Must-Have

Setting up e-commerce tracking isn't just about adding more charts to your dashboard, it's about unlocking crucial business insights. When you connect your sales data to Analytics, you can finally answer mission-critical questions like:

  • Which marketing channels (Organic Search, Paid Social, Email) are generating the most revenue, not just clicks?
  • What is the average order value (AOV) for customers coming from different campaigns?
  • How many times do users visit the site before making a purchase?
  • Which products are most frequently added to the cart but not purchased?
  • What's the true return on ad spend (ROAS) for your Google Ads or Facebook Ads campaigns?

Without this connection, you're making decisions based on incomplete information. With it, you can accurately measure performance, optimize your marketing spend, and understand the user journey from initial click to final purchase.

The Great Divide: GA4 vs. Universal Analytics

Before you dive in, it’s critical to know which version of Google Analytics you're using. Google officially replaced its classic Universal Analytics (UA) with Google Analytics 4 in July 2023. While all new setups will be on GA4, many businesses still have historical UA properties they reference.

  • Google Analytics 4: The current standard. It’s event-based, meaning everything from a page view to a purchase is tracked as an "event." Ecommerce setup in GA4 is more streamlined and often handled by your website platform's integration.
  • Universal Analytics (UA): The older version. It’s session-based and required you to manually "enable" e-commerce tracking in the settings. This platform no longer processes new data.

We'll cover the process for GA4 first, as it's the current and future standard.

GraphedGraphed

Still Building Reports Manually?

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

Watch Graphed demo video

How to Set Up Ecommerce Tracking in Google Analytics 4

In GA4, there isn’t a simple on/off switch for e-commerce like in the old UA. Instead, GA4 is designed to automatically recognize specific e-commerce events when they're sent from your website. Your job is to make sure your site is sending these events correctly.

There are two primary ways to do this: through a native platform integration or a manual setup with Google Tag Manager.

Method 1: The Easy Way - Using a Platform Integration

The good news is that most modern e-commerce platforms do the heavy lifting for you. Platforms like Shopify, BigCommerce, and WooCommerce (with a plugin) have built-in integrations that automatically send the required e-commerce events to GA4.

Here’s a look at how simple it is on the most popular platform, Shopify.

Example: Setting up GA4 on Shopify

Shopify's native Google Analytics integration makes this process incredibly easy. All you have to do is connect your account.

  1. From your Shopify admin, go to Online Store > Preferences.
  2. In the "Google Analytics" section, click "Manage pixel here." You'll be taken to the Google & YouTube app in your Shopify admin.
  3. Connect your Google account and you'll be prompted to select your GA4 measurement ID (it looks like G-XXXXXXXXXX).
  4. Once connected, Shopify automatically starts sending all the critical e-commerce events to GA4—view_item, add_to_cart, begin_checkout, and of course, purchase—along with revenue, product details, and quantities.

Most major platforms have a similarly straightforward process. As long as your Google Analytics tag is properly installed through their recommended app or integration, e-commerce data should flow automatically without you needing to touch any code.

GraphedGraphed

Still Building Reports Manually?

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

Watch Graphed demo video

Method 2: The Manual Way - Using Google Tag Manager (GTM)

If you have a custom-built website or your platform doesn’t have a native integration, you’ll need to set up tracking manually using Google Tag Manager. This method provides more control but requires a bit more technical comfort.

The core concept is to create a "data layer" on your website. A data layer is a snippet of code that holds information and passes it from your website to GTM. Your developer will need to implement this on your site so that when a user takes an action (like clicking "Add to Cart"), the product info, price, and event name are pushed to the data layer.

Step 1: Implement the Data Layer

Your developer needs to add code that triggers the standardized GA4 e-commerce events. For a purchase, the data layer code snippet pushed from your backend after a successful transaction would look something like this:

window.dataLayer = window.dataLayer || [],
window.dataLayer.push({
  event: 'purchase',
  ecommerce: {
      transaction_id: 'T_12345',
      value: 25.42,
      tax: 4.90,
      currency: 'USD',
      items: [{
        item_id: 'SKU_12345',
        item_name: 'Classic T-Shirt',
        price: '14.99',
        quantity: 1
      }]
  }
}),

You'll need similar data layer pushes for other e-commerce actions like view_item, add_to_cart, and begin_checkout.

Step 2: Configure GTM

Once the data layer is in place, you configure GTM to listen for these events and send the data to GA4.

  1. Create a GA4 Event Tag: In your GTM container, create a new tag. Select "Google Analytics: GA4 Event" as the tag type.
  2. Select Your Configuration Tag: Choose your main GA4 Configuration Tag (the one you use for page views).
  3. Set the Event Name: For the "Event Name," instead of typing a static name like "purchase," use a variable. GTM recognizes events pushed to the data layer. You can use {{Event}} and GTM will dynamically insert the event name ('purchase', 'add_to_cart', etc.).
  4. "More Settings" > Send E-commerce Data: Be sure to check the box for "Send e-commerce data." GTM will automatically look for the e-commerce data in the data layer when it sees a compatible event.

Repeat this step to set up a universal "trigger" that fires this tag on all your e-commerce events.

Step 3: Create the Trigger

The trigger tells your tag when to fire.

  1. Create a new trigger and choose "Custom Event" as the trigger type.
  2. In the "Event Name" box, you will use RegEx to capture all the official GA4 e-commerce events in one go. Enter this pattern: add_to_cart|begin_checkout|purchase|refund|remove_from_cart|select_item|view_item|view_item_list.
  3. Check the "Use regex matching" box.
  4. Save this trigger and assign it to your GA4 Event tag.

Now, whenever one of those events is pushed to the data layer, your trigger will fire, causing your tag to send that complete event and its associated e-commerce data to Google Analytics 4.

GraphedGraphed

Still Building Reports Manually?

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

Watch Graphed demo video

Verifying Your Ecommerce Setup

After setting everything up, you need to confirm that Google Analytics is actually receiving the data.

  • Use GA4's DebugView: In your GA4 property, navigate to Admin > DebugView. In a separate window, browse your website and complete a test purchase. You should see the events (view_item, add_to_cart, purchase) appear in DebugView in real-time. Click on the purchase event to confirm that all the parameters (like value, transaction_id, and items) are being captured correctly.
  • Check the Monetization Reports: After 24-48 hours, data should start populating in your Monetization reports. Go to Reports > Monetization > Ecommerce purchases to see your purchase data, revenue, AOV, and more start trickling in.

A Quick Note on Universal Analytics (Legacy)

If you're looking at an old UA property for historical analysis, the setup was different. You had to:

  1. Go to Admin > View Settings > Ecommerce Settings.
  2. Toggle "Enable Ecommerce" and "Enable Enhanced Ecommerce Reporting" to ON.
  3. Implement the respective ga.js tracking code on your purchase confirmation page, which was usually handled by your platform's plugin.

This process is no longer relevant for new tracking, but it's helpful context for understanding older Analytics accounts.

Final Thoughts

Getting your purchase and revenue data flowing into Google Analytics is the first step toward building a truly data-driven e-commerce strategy. It transforms Analytics from a simple traffic monitor into a powerful tool that connects your marketing funnels directly to your sales performance.

Of course, getting data into Google Analytics is just one piece of the puzzle. Answering your most important questions often requires combining GA data with performance stats from Shopify, Facebook Ads, Google Ads, and your CRM. We built Graphed to do exactly that, without the spreadsheet chaos. You just connect your sources, ask questions in plain English like "Show me a dashboard of my Facebook Ads spend vs. Shopify revenue by campaign for last month," and get a live dashboard in seconds. It bridges the gap between having data and actually using it to grow your business.

Related Articles