How to Track Sales in Google Analytics

Cody Schneider8 min read

Tracking sales in Google Analytics is the most direct way to prove your marketing is actually working. It connects the dots between your ad campaigns, content marketing, and social media efforts and the one metric that matters most: revenue. This guide will walk you through setting up sales tracking in both Google Analytics 4 and Universal Analytics (UA) for those managing older setups.

GraphedGraphed

Still Building Reports Manually?

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

Watch Graphed demo video

Why Should You Track Sales in Google Analytics?

Simply knowing your total revenue isn't enough. When you integrate your sales data into Google Analytics, you unlock a much deeper level of understanding about your business and customers. It’s the difference between knowing you made money and knowing how you made it.

  • Attribute Revenue to Marketing Channels: Finally get a clear answer to "Which channels drive the most sales?" See exactly how much revenue comes from organic search, paid ads, email campaigns, or social media, helping you decide where to invest your budget.
  • Calculate True ROI: By combining sales data with ad spend data (from platforms like Google Ads or Facebook Ads), you can calculate the return on investment for specific campaigns and keywords with much greater accuracy.
  • Understand the Customer Journey: Discover which pages and content users view right before making a purchase. You can see which blog posts lead to sales or which landing pages have the highest conversion rates.
  • Identify Your Most Valuable Products: Learn which products are your bestsellers, which are viewed most often, and which ones have high add-to-cart rates but low purchase rates, potentially highlighting an issue with pricing or product descriptions.

Getting Started: Your Pre-Flight Checklist

Before you dive into the setup, make sure you have a few things in place. This will make the entire process much smoother.

  • A Website with a Shopping Cart: You need an ecommerce platform like Shopify, WooCommerce, Magento, BigCommerce, or a custom-built solution where transactions happen.
  • Google Analytics Property: You should already have a Google Analytics account set up for your website. We'll be focusing primarily on Google Analytics 4, which is the current standard.
  • Access Rights: You'll need admin or editor access to your Google Analytics account. You also need access to your website's backend, either through the platform's admin panel (like Shopify) or a tool like Google Tag Manager (GTM).

How to Set Up Ecommerce Tracking in Google Analytics 4

GA4 treats everything as an "event" - from page views to purchases. To track sales, you need to send specific ecommerce events to GA4, like purchase, add_to_cart, and begin_checkout. Fortunately, there are two primary ways to do this, ranging from super simple to highly flexible.

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 a Platform Integration or Plugin

Most modern ecommerce platforms have built-in integrations or official plugins that do almost all the heavy lifting for you. They’re designed to automatically send the required transaction data to Google Analytics without you having to touch a line of code.

For Shopify Users

Shopify's native "Google & YouTube" app is the recommended way to set up GA4 tracking.

  1. From your Shopify admin, go to Apps and search for the Google & YouTube channel. Install it if you haven't already.
  2. Follow the steps to connect your Google account.
  3. In the setup process, choose your GA4 property. The app will automatically place the necessary GA4 code and configure the ecommerce events (like add_to_cart and purchase).
  4. That’s it! The integration handles sending the detailed transaction information whenever a sale occurs.

For WooCommerce Users

WooCommerce has several excellent plugins that can automate GA4 ecommerce tracking.

  1. An officially supported option is to use a plugin that implements the Google Tag (gtag.js) for you. Look for plugins in the WordPress repository like "Google Analytics for WordPress by MonsterInsights" or "GA Google Analytics."
  2. A more advanced (but highly recommended) route is to use the “GTM4WP” (Google Tag Manager for WordPress) plugin. This will automatically populate a detailed data layer on your site, which you can then use with Method 2 below. For many, simply installing GTM4WP and hooking it up to GA4 via Google Tag Manager is all you need for basic tracking.
  3. Once installed and configured with your GA4 Measurement ID (it looks like G-XXXXXXXXXX), the plugin will start sending ecommerce events to your property.
GraphedGraphed

Still Building Reports Manually?

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

Watch Graphed demo video

Method 2: The Flexible Way with Google Tag Manager and the Data Layer

If you're not using a popular platform or want complete control over your tracking, Google Tag Manager (GTM) is the way to go. This method depends on something called a data layer.

Think of the data layer as a hidden virtual layer of your website that holds important information. When a customer makes a purchase, your website's code "pushes" all the details of that transaction (like the total price, products bought, and transaction ID) into the data layer. Google Tag Manager can then read this information and send it to Google Analytics in a beautifully structured way.

This process usually requires a developer to implement the data layer snippet on your "thank you" or order confirmation page.

Step 1: Get the Data Layer Code Implemented

Your developer needs to add a script to your post-purchase page that populates the dataLayer with purchase information. Here’s a standard example of a GA4 purchase data layer:

window.dataLayer = window.dataLayer || [],
window.dataLayer.push({
  event: 'purchase',
  ecommerce: {
      transaction_id: 'T12345',
      value: 99.99,
      tax: 7.50,
      shipping: 5.99,
      currency: 'USD',
      coupon: 'SUMMERSALE',
      items: [
       {
        item_id: 'SKU_123',
        item_name: 'Classic T-Shirt',
        item_category: 'Apparel',
        price: 24.99,
        quantity: 2
       },
       {
        item_id: 'SKU_456',
        item_name: 'Denim Jeans',
        item_category: 'Apparel',
        price: 49.99,
        quantity: 1
       }]
  }
}),

Step 2: Set Up Triggers and Variables in GTM

Once the data layer is in place, you’ll configure GTM to read it.

  1. Create the Trigger: In GTM, go to Triggers > New. Choose "Custom Event" as the trigger type. For the event name, enter purchase, which matches the event name in your data layer script. Save it.
  2. Create Data Layer Variables: To capture the data, you need to tell GTM which pieces of the data layer you want. Go to Variables > User-Defined Variables > New. Choose "Data Layer Variable" as the type. For each piece of data, create a variable. For example:

Step 3: Create the GA4 Event Tag

Finally, you'll create the tag that sends the information to Google Analytics.

  1. In GTM, go to Tags > New.
  2. Select "Google Analytics: GA4 Event" as the tag type.
  3. Select your main GA4 Configuration Tag.
  4. For the "Event Name," type purchase (this must be exact).
  5. Under "Event Parameters," click "Add Row" for each piece of data you want to send. The "Parameter Name" must be the official name GA4 expects, and the "Value" will be the GTM variables you just created.
  6. Link this tag to the "purchase" trigger you created earlier.
  7. Save, preview/test, and publish your GTM container!

How to Find Your Sales Data in Google Analytics

Once you’ve set everything up and some sales have come through, you can start digging into the data.

In your Google Analytics 4 property, the primary reports live under the "Monetization" section:

  • Go to Reports > Monetization > Ecommerce purchases. Here you'll see a wealth of data, including:
  • In the Traffic acquisition report (under Acquisition), you can see exactly which channels (Organic Search, Direct, Paid Search, etc.) are generating your revenue.
GraphedGraphed

Still Building Reports Manually?

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

Watch Graphed demo video

For Those with Universal Analytics

While Universal Analytics is no longer collecting new data, you might still need to view historical sales data. You'll find it by navigating to Conversions > Ecommerce.

  • The Overview report gives you a top-level summary.
  • The Product Performance report shows which specific items are selling best.
  • The Sales Performance report lists individual transactions by their ID.

Go Beyond Transactions: Tracking B2B "Sales" Goals

Not every business has an ecommerce store. If your "sale" is a lead, a demo request, or a contact form submission, you can (and should) track these as well.

  1. Identify your key conversion event, like a "Thank You" page view after a form is submitted.
  2. Set up an event in GA4 (via GTM or gtag.js) that fires on that specific conversion action (for example, an event named generate_lead).
  3. In GA4, go to Admin > Conversions. Find your new event in the list and simply flip the switch to mark it as an official conversion. Now, GA4 will treat this generate_lead action with the same importance as an ecommerce purchase, allowing you to see which campaigns and channels are driving the most valuable leads for your business.

Final Thoughts

Setting up ecommerce tracking in Google Analytics is a foundational step for any business selling online. It elevates your analysis from guesswork to data-backed strategy, allowing you to see what’s working, what isn’t, and how to allocate your resources to grow your revenue effectively.

But seeing your sales data in one platform is just the beginning. The real insights happen when you can see that data alongside your ad spend from Facebook, customer data from Salesforce, and email performance from Klaviyo. That's where we built Graphed to help. We make it easy to connect all your data sources in one place and use simple, natural language - like "show me which Facebook campaigns drove the most Shopify sales last month" - to instantly generate the reports and dashboards you need. No more exporting CSVs or fighting with complicated tools, just fast answers to your biggest business questions.

Related Articles

How to Enable Data Analysis in Excel

Enable Excel's hidden data analysis tools with our step-by-step guide. Uncover trends, make forecasts, and turn raw numbers into actionable insights today!