How to Set Up Ecommerce Tracking in Google Analytics

Cody Schneider

Seeing sales numbers in your platform is one thing, but understanding the entire customer journey that leads to a purchase is where real growth happens. Setting up ecommerce tracking in Google Analytics 4 gives you that clarity, connecting your ad campaigns, content marketing, and on-site behavior directly to your revenue. This guide walks you through the process step-by-step, whether you're using a common platform like Shopify or a fully custom website.

Why Ecommerce Tracking is a Game-Changer

Without proper tracking, you're essentially guessing what works. When you take the time to set up ecommerce reporting in GA4, you unlock the ability to answer critical business questions:

  • Which marketing channels drive the most sales? See exactly how much revenue comes from organic search, paid ads, social media, or email campaigns, allowing you to double down on what’s working.

  • Which products are your top performers? Go beyond just sales volume. Find out which items are viewed most, added to cart most frequently, and ultimately purchased. This helps with everything from inventory management to homepage promotions.

  • Where are shoppers dropping off? The path to purchase often has leaks. You can analyze the shopping funnel to see how many users view a product, add it to their cart, begin the checkout process, and finally complete the sale. Finding a significant drop-off at a specific stage flags an opportunity for improvement.

  • What's the real ROI of your ad spend? By tracking revenue tied to specific campaigns, you can calculate your return on ad spend (ROAS) accurately, ensuring your marketing dollars are invested wisely.

Getting Started: Your Pre-Flight Checklist

To make the setup process as smooth as possible, make sure you have the following ready to go:

  • Admin-level access to your Google Analytics 4 property. You'll need this to get your Measurement ID.

  • Admin access to your ecommerce platform's backend (e.g., Shopify, BigCommerce, or your WordPress dashboard for WooCommerce).

  • The correct GA4 Measurement ID for your property. You can find this in GA4 by navigating to Admin > Data Streams > [Select your web stream]. It starts with "G-" followed by a string of characters.

If you're using a custom-built website, you will also likely need access to Google Tag Manager and potentially the assistance of a developer for a single, crucial step.

Choose Your Implementation Path

There are two primary ways to get your ecommerce data into Google Analytics. Your choice will almost entirely depend on the platform your online store is built on.

  1. The Easy Path: Using a Native Integration or Plugin. Most major ecommerce platforms like Shopify, BigCommerce, and WooCommerce (via plugins) have built-in capabilities to send ecommerce data to GA4. It’s often as simple as copying and pasting your Measurement ID. This method is perfect for about 90% of stores.

  2. The Advanced Path: Manual Setup with Google Tag Manager. If your store is built on a custom platform or if you need highly customized tracking, this method offers the most flexibility and control. It’s more technical and requires setting up something called a "data layer."

We'll walk through both, starting with the easy path.

Method 1: The Easy Path with Platform Integrations

If you use a popular ecommerce platform, you're in luck. The integration is usually straightforward and requires no coding. Here’s how to do it for two of the most popular platforms.

Setting Up GA4 Ecommerce Tracking on Shopify

Shopify makes this process incredibly simple. Their integration handles sending all the crucial ecommerce events (like view_item, add_to_cart, and purchase) to Google Analytics automatically.

  1. From your Shopify Admin dashboard, go to Online Store > Preferences.

  2. Scroll down to the "Google Analytics" section.

  3. Click on Manage pixel here.

  4. Shopify uses a Google & YouTube app. Click Connect or check that your Google account is already connected.

  5. You'll be prompted to select your GA4 Measurement ID from a list. Select the appropriate "G-" ID for your store and click Connect.

That's it! Shopify will now automatically send sales data over to your GA4 property. It usually takes 24-48 hours for new transaction data to begin appearing in your ecommerce reports.

Setting Up GA4 Ecommerce Tracking on WooCommerce

For WooCommerce stores on WordPress, the most reliable method is using a plugin. These plugins create the necessary bridge between your store's transaction data and what Google Analytics needs to receive.

While there are many options, we recommend a robust plugin that can also manage Google Tag Manager, as it provides a great foundation for any future tracking with a plugin like GTM4WP (Google Tag Manager for WordPress). Even if you're not a GTM expert, this plugin makes ecommerce tracking easy.

  1. In your WordPress dashboard, go to Plugins > Add New.

  2. Search for "GTM4WP," install it, and activate it.

  3. Go to the plugin's settings via Settings > Google Tag Manager.

  4. On the "General" tab, enter your Google Tag Manager Container ID (NOT your GA4 "G-" ID). This connects your whole site to GTM. You must also place your GA4 tag inside this GTM container–ideally through the Google tag using your GTM to GA4 ‘G-’ Measurement ID, under the Destination Setting.

  5. Click the Integration tab and select WooCommerce.

  6. Check the box for Track classic ecommerce, and then check the GA4 checkbox below. All other events like 'Customer data', 'Add-to-Cart' events will typically pre-select—so feel free to review all of what you want to connect to Google Tag Manager. Then select Save.

The plugin will now create the necessary data layer that sends all of your WooCommerce checkout and sales information into Google Tag Manager, which then passes it to Google Analytics 4.

Method 2: The Advanced Path with Google Tag Manager

If you have a custom site or your platform lacks a native integration, Google Tag Manager (GTM) is your friend. This path requires a bit of code to be placed on your site by a developer, which GTM uses to grab transaction details and forward them to GA4.

Step 1: Implementing a Data Layer

A data layer is just a snippet of JavaScript code that organizes transaction information into a standard format that GTM can easily understand. When a customer makes a purchase, your website needs to "push" the details of that sale (like the transaction ID, value, and items purchased) into this data layer.

This is typically a task for a developer. You can send them Google's official GA4 ecommerce development documentation. Here is an example of what the code looks like for a purchase event:

Your developer needs to implement this code (with dynamic values pulled from your order system) on your purchase confirmation page.

Step 2: Configuring Google Tag Manager

Once the data layer is in place on your site, you need to configure GTM to read that data and send it to GA4.

  1. Create a Trigger:

    • Go to Triggers > New and name it "Event - Purchase".

    • Choose the trigger type "Custom Event".

    • For the Event name, enter purchase. This must match the event name in the data layer code exactly.

    • Save the trigger.

  2. Create a Tag:

    • Go to Tags > New and name it "GA4 - Ecommerce - Purchase".

    • Click "Tag Configuration" and select "Google Analytics: GA4 Event".

    • Select your main GA4 Configuration Tag.

    • For the Event Name, enter purchase. This name is a standard, recommended Google event.

    • Expand "Event Parameters" and check the box that says "Send Ecommerce data". The tag will attempt to pull this automatically from a correctly formatted GTM data layer on the site.

    • Under "Triggering," select the "Event - Purchase" trigger you created in the last step.

    • Save the tag.

After creating this, be sure to Publish your changes in GTM.

Verifying That Your Tracking Is Working

Don't just set it and forget it. It's crucial to confirm that data is flowing correctly. Here’s how you can check.

1. Use Google Tag Manager's Preview Mode

If you used the GTM method, this is your best friend. Click "Preview" in GTM, enter your website URL, and perform a test transaction. On the summary page, you should see the purchase event in the left-hand column. Click it and check that your "GA4 - Ecommerce - Purchase" tag fired successfully.

2. Check GA4's DebugView

The most reliable way to check for all installation paths is DebugView. In GA4, go to Admin > DebugView. If your GTM preview is active or your site is sending debug signals, you'll see a live stream of events. Complete a test purchase and watch for the purchase event to appear in the timeline. Click on it to inspect its parameters (like items, value, transaction_id) and ensure they look correct.

3. Review Your Ecommerce Reports

After you've confirmed events are firing in real-time, the final step is to check your actual reports. Wait 24-48 hours, then navigate to Reports > Monetization > Ecommerce purchases in GA4. You should see your test transaction data, as well as new sales, begin to populate the tables and charts. Congratulations - your tracking is live!

Final Thoughts

Setting up ecommerce tracking in Google Analytics transforms it from a simple traffic-monitoring tool into a powerful business analysis engine. Whether you just had to paste an ID into Shopify or you dove into a manual GTM setup, the valuable insight you’ve unlocked into your products, customers, and marketing performance will pay dividends for years to come.

Of course, getting the data into Google Analytics is just the first step. The real challenge is analyzing that data alongside information from your ad platforms, email service, and CRM to get a complete picture. We built Graphed to solve this by making sophisticated analysis accessible to everyone. Simply connect your sources like GA4, Shopify, and Facebook Ads, and then ask questions in plain English — like "Show me a comparison of revenue from Google Ads vs Facebook Ads this month" or "Which products have the highest add-to-cart rate but a low purchase rate?" — and get instant, real-time dashboards that do the heavy lifting for you.