top of page

Enhanced eCommerce Tracking in GA4

Updated: Oct 1, 2024

Enhanced ecommerce tracking in Google Analytics provides invaluable insights into user behavior and product performance, allowing businesses to optimize their online stores effectively. By implementing enhanced ecommerce tracking through Google Tag Manager , you can gain a comprehensive view of your users’ journeys, from product views to final purchases.


We're going to walk you through the step-by-step process of setting up enhanced ecommerce tracking in GA4.


Step 1: Prepare Your GA4 Property

Before diving into Google Tag Manager, ensure that your GA4 property is set up for enhanced ecommerce.


1.1 Enable Enhanced Ecommerce in GA4


  1. Log into your GA4 account.

  2. Navigate to the Admin panel.

  3. Under the Property column, select Data Streams.

  4. Choose the data stream for your website.

  5. Scroll down to enhanced Measurement and click on Configure Tag Settings.

  6. Enable enhanced ecommerce to start tracking.


Step 2: Set Up Google Tag Manager


If you haven’t already set up GTM for your website, follow these steps:


2.1 Create a GTM Account


  1. Go to the Google Tag Manager website.

  2. Click on Create Account.

  3. Fill in your account name, container name, and select "Web" as the target platform.

  4. Click Create and accept the terms of service.


2.2 Add GTM Code to Your Website


  1. Once your container is created, GTM will provide you with two code snippets.

  2. Copy and paste the first snippet into the <head> section of your website.

  3. Paste the second snippet immediately after the opening <body> tag.


Step 3: Implement Enhanced Ecommerce Events


To track user interactions with products, you need to set up various ecommerce events in GTM.


3.1 Create a Data Layer


A Data Layer is essential for passing ecommerce data to GA4. Insert the following script in your website's <head> section before the GTM code:


<script>

window.dataLayer = window.dataLayer || [];

</script>


3.2 Push Ecommerce Events to the Data Layer


Add the appropriate event pushes to your site's code where relevant. Here are some common ecommerce events:


Product Impressions (when products are displayed):


dataLayer.push({

  event: 'view_item_list',

  ecommerce: {

    items: [

      {

        item_name: 'Product 1',

        item_id: 'SKU_001',

        price: 29.99,

        item_category: 'Category 1',

        index: 1

      },

      // Additional products...

    ]

  }

});


Product Clicks (when a user clicks on a product):


dataLayer.push({

  event: 'select_item',

  ecommerce: {

    items: [

      {

        item_name: 'Product 1',

        item_id: 'SKU_001',

        price: 29.99,

        item_category: 'Category 1'

      }

    ]

  }

});


Add to Cart:


dataLayer.push({

  event: 'add_to_cart',

  ecommerce: {

    items: [

      {

        item_name: 'Product 1',

        item_id: 'SKU_001',

        price: 29.99,

        item_category: 'Category 1',

        quantity: 1

      }

    ]

  }

});


Checkout Initiated:


dataLayer.push({

  event: 'begin_checkout',

  ecommerce: {

    items: [

      {

        item_name: 'Product 1',

        item_id: 'SKU_001',

        price: 29.99,

        item_category: 'Category 1',

        quantity: 1

      }

    ]

  }

});


Purchases:


dataLayer.push({

  event: 'purchase',

  ecommerce: {

    transaction_id: 'TRANSACTION_ID',

    affiliation: 'Online Store',

    value: 59.98,

    tax: 4.99,

    shipping: 5.99,

    currency: 'USD',

    items: [

      {

        item_name: 'Product 1',

        item_id: 'SKU_001',

        price: 29.99,

        item_category: 'Category 1',

        quantity: 1

      }

    ]

  }

});


3.3 Create Tags in GTM


  1. In GTM, click Tags and then New.

  2. Choose Tag Configuration, then select Google Analytics: GA4 Event.

  3. Set the Configuration Tag to your GA4 tag (create one if you haven’t).

  4. Under Event Name, enter the event name that matches your Data Layer pushes (e.g., view_item_list, add_to_cart).

  5. In the Event Parameters section, add parameters corresponding to the data you are sending in the Data Layer.


3.4 Set Up Triggers


  1. Click on Triggering to add a trigger for the tag.

  2. For events like view_item_list, choose Page View and specify that it triggers on specific pages (e.g., your product listing page).

  3. For interaction events (e.g., add_to_cart), choose Custom Event and specify the event name you used in your Data Layer push.


Step 4: Testing Your Implementation


  1. In GTM, click on Preview to enter Preview mode.

  2. Open your website in a new tab to test the Data Layer events. Interact with your products to see if the events are pushed correctly.

  3. Check the GTM Debugger to ensure that events are firing as expected.


Step 5: Publish Your GTM Container


Once you’ve tested and confirmed that everything is working correctly:

  1. Go back to GTM and click on Submit.

  2. Provide a name and description for your changes, then click Publish.


Step 6: Review Enhanced Ecommerce Reports in GA4


  1. In GA4, navigate to Reports.

  2. Under Monetization, explore the Ecommerce Purchases and Product Performance reports to analyze user behavior and product metrics.

  3. Use the insights to make data-driven decisions regarding your ecommerce strategy.


Setting up enhanced ecommerce tracking in GA4 with Google Tag Manager is essential for gaining deep insights into user interactions and product performance. By following these steps, you can effectively monitor user journeys, optimize your marketing strategies, and ultimately drive revenue growth. With the wealth of data at your fingertips, you’ll be better equipped to understand your customers and refine your ecommerce approach.


Happy tracking!


Partner with true industry veterans at The Move. We specialize in Google Ads, SEO, HubSpot Services, CRO and Analytics. Driving growth through tailored custom strategies for Paid Media, SEO and HubSpot. Maximize your ROI, boost organic search rankings, streamline marketing processes, and make data-driven decisions with our innovative strategies and access to the industries best tools.



bottom of page