Waqar Azeem

How to Set Up Enhanced Ecommerce Tracking with GTM + GA4

ByFatima

13 September 2025

* All product/brand names, logos, and trademarks are property of their respective owners.

If you're running an online store, tracking your customers' journey from product views to purchases is absolutely essential. But with Google phasing out Universal Analytics, and GA4 now fully in place, many ecommerce store owners are left scratching their heads: How do I now track product views, add-to-carts, checkouts, and purchases?

Enter Enhanced Ecommerce tracking with GA4 (Google Analytics 4) a powerful way to collect detailed data about your shoppers’ behavior. And when combined with Google Tag Manager (GTM), it becomes even more efficient and flexible.

In the old days, Universal Analytics allowed for enhanced ecommerce tracking through plugins and detailed ecommerce reports. But GA4 works differently. It uses an event-based model, where every action like view_item, add_to_cart, or purchase is tracked as a standalone event with customizable parameters.

This new model gives marketers and developers more control, but also requires a fresh setup from scratch.

That’s where GTM comes in. With Google Tag Manager, you can deploy all these ecommerce tracking events without editing your website code directly making the process faster, safer, and more scalable.

But here's the thing: setting this up isn’t always easy. There are common pitfalls like missing required parameters, firing duplicate events, or misconfigured data layers that can cause your data to break or become unreliable.

In this complete guide, we’ll walk you through exactly how to set up Enhanced Ecommerce tracking in GA4 using GTM, step-by-step. Whether you're starting fresh with GA4 or migrating from Universal Analytics, this guide is for you.

By the end, you’ll know:

  • How to prepare your site and data layer

  • The exact events to track in GA4 (with code examples)

  • How to debug and test each ecommerce event

  • Common mistakes to avoid

  • Advanced tips, including real-world examples for Pakistani ecommerce businesses

Let’s get started

Preparing for GA4 Enhanced Ecommerce Setup

Before you jump into Google Tag Manager or start firing ecommerce events to GA4, it's important to understand how everything works behind the scenes. Setting things up the right way from the beginning will save you from hours of debugging and broken reports later.

Let’s start by breaking down how ecommerce tracking works in GA4 and what you need in place before implementation.

Understanding the GA4 Ecommerce Event Model

In GA4, everything is tracked as an event whether a user is viewing a product, adding it to cart, or completing a purchase. Each event is paired with parameters that provide additional context.

Here are the key ecommerce events GA4 supports:

Event Name Description
view_item When a user views a product page
view_item_list Viewing a list of products (e.g. category page)
select_item Clicking a product from a list
add_to_cart Adding a product to the cart
remove_from_cart Removing a product from the cart
begin_checkout When the user enters the checkout
add_payment_info Adding payment method
add_shipping_info Selecting a shipping method
purchase Completing the purchase
refund Issuing a refund

Each of these events uses item-based parameters like:

  • item_id

  • item_name

  • price

  • currency

  • quantity

  • item_brand

  • item_category

GA4 expects ecommerce data to be structured inside an “items” array, even for a single item. This is different from Universal Analytics, where single products could be sent as standalone values.

Example format:

 

items: [{
  item_id: '12345',
  item_name: 'Blue Sneakers',
  item_brand: 'Nike',
  item_category: 'Shoes',
  price: 4999,
  currency: 'PKR',
  quantity: 1
}]

 

Setting Up Your Data Layer Correctly

Your dataLayer is the foundation of GA4 ecommerce tracking. It's a JavaScript object that stores all the ecommerce info you want to pass to GTM, which in turn sends it to GA4.

Here’s what a basic purchase dataLayer might look like:

 

window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
  event: "purchase",
  ecommerce: {
    transaction_id: "T12345",
    value: 9999,
    currency: "PKR",
    items: [
      {
        item_id: "SKU123",
        item_name: "White T-Shirt",
        price: 9999,
        quantity: 1
      }
    ]
  }
});

 

Key Tips:

  • Always push the ecommerce object with the correct event name (like purchase, add_to_cart, etc.)

  • Ensure all required parameters are present. GA4 will not register events if certain fields are missing.

  • For local setups (like in Pakistan), always specify currency: "PKR" and use local pricing logic.

  • Maintain consistent naming conventions across your site and GTM

You can use tools like the GTM Preview Mode and GA4 DebugView to verify that your dataLayer pushes are firing correctly.

Tools You’ll Need – GTM, GA4, DebugView

Before implementation, make sure you have the right tools in place:

  1. Google Tag Manager (GTM)

    • Set up a GTM container for your site

    • Install GTM script on all pages

    • This allows you to deploy ecommerce tags without editing your codebase directly.

  2. Google Analytics 4 (GA4)

    • Create a GA4 property and set up a data stream

    • Link GA4 to GTM using the “GA4 Configuration” tag

    • This tag initializes GA4 on your site

  3. GA4 DebugView

    • Found inside GA4 under Admin > DebugView

    • Shows you which events are firing in real-time

    • Very useful for checking ecommerce events like view_item, add_to_cart, etc.

  4. Browser Console & Extensions

    • Use browser dev tools to inspect your dataLayer

    • Extensions like “GA Debugger” and “Tag Assistant” are handy

Once these are ready, you’re fully equipped to begin the ecommerce tracking setup.

Implementing GA4 Enhanced Ecommerce Tracking with GTM

Now that you’ve prepped your data layer and configured your tools, it’s time to get your hands dirty with the actual implementation. Google Tag Manager (GTM) will be your main interface for sending ecommerce events to GA4. The beauty of this method is that you don't need to constantly touch your website's codebase everything happens in GTM.

Let’s go through the most critical ecommerce events you’ll want to track, how to set them up in GTM, and how to avoid common pitfalls.

Step-by-Step Setup for Key Ecommerce Events

General Setup Steps for All Events:

  1. Ensure the correct dataLayer is pushed on the relevant page (e.g. add_to_cart when user clicks "Add to Cart").

  2. Create a Trigger in GTM that fires when the dataLayer event is pushed.

  3. Create a GA4 Event Tag using the “GA4 Event” tag type in GTM.

  4. Use the ‘Event Name’ field to match GA4 ecommerce events exactly (e.g. purchase, add_to_cart, etc.).

  5. Use “Event Parameters” to map dataLayer variables (like item_id, price, etc.) to GA4.

Example 1: add_to_cart

Step-by-step:

  1. On your site, ensure this dataLayer code is pushed when someone adds a product to their cart:

 

window.dataLayer.push({
  event: "add_to_cart",
  ecommerce: {
    currency: "PKR",
    value: 1499,
    items: [{
      item_id: "P001",
      item_name: "Red Hoodie",
      price: 1499,
      quantity: 1
    }]
  }
});

 

  1. In GTM:

    • Create a Custom Event Trigger:

      • Event Name: add_to_cart

    • Create a GA4 Event Tag:

      • Configuration Tag: your GA4 config

      • Event Name: add_to_cart

      • Event Parameters: Use variables to pass ecommerce data

  2. Save and test using Preview Mode and GA4 DebugView.

Repeat this process for other key events like:

  • view_item

  • begin_checkout

  • purchase

You’ll just change the dataLayer and triggers accordingly.

Testing Each Event:

Use these tools for testing:

  • GTM Preview Mode: Ensure the right tag fires on the right trigger.

  • GA4 DebugView: See real-time events and confirm parameters are passed.

  • GA4 Reports > Events: After 24-48 hours, your events should appear here for long-term tracking.

Common Mistakes and How to Fix Them

Setting up GA4 Enhanced Ecommerce via GTM isn’t always smooth sailing. Here are common issues you might face and how to solve them.

 

Problem Why It Happens Fix
Events Not Firing Trigger doesn't match dataLayer event Double-check the event name in GTM Trigger (case-sensitive!)
Missing Parameters items[] array is empty or required fields missing Always include item_id, item_name, price, currency, and quantity
Purchase Value Showing as 0 GA4 doesn’t receive the value field Ensure value is present in the ecommerce object in your dataLayer
Duplicate Events Tags firing twice or on incorrect pages Use DebugView + GTM Preview to verify firing rules
Event Not Visible in Reports Delay in GA4 processing or parameter errors Wait 24–48 hours and check DebugView; ensure parameters match GA4 expectations

 

Post-Setup – Reporting and Funnel Building in GA4

Once everything is firing correctly, the real magic starts: reporting.

Here’s how to get the most out of your ecommerce data in GA4:

Standard Ecommerce Reports:

  • Go to Reports > Monetization > Ecommerce Purchases

  • You’ll see product names, item revenue, purchase quantity, etc.

  • Make sure item_name, item_id, and price are passed consistently

Funnel Reports (Explorations):

  • Go to Explore > Funnel Exploration

  • Build custom funnels such as:

    • View Product → Add to Cart → Checkout → Purchase

  • Add filters for specific products, categories, or user segments

Tips:

  • Add custom dimensions if you want to track local parameters like “product region” or “campaign ID”

  • Use UTM parameters to tie ecommerce actions to campaigns

  • Segment users by behavior (e.g. repeat purchases, abandoned cart)

Advanced Tips, Use Cases & Localized Examples

Once your basic GA4 Enhanced Ecommerce setup is in place, it’s time to go beyond the basics. This section dives into practical strategies for migrating from Universal Analytics, using localized setups for Pakistani ecommerce, and optimizing your tracking for better insights and marketing performance.

Migration Strategy from UA to GA4 Enhanced Ecommerce

If you're coming from Universal Analytics (UA), you're probably familiar with the Enhanced Ecommerce plugin (ec.js) and its built-in reports. GA4 works differently, and migration isn't a simple copy-paste job.

Key Differences Between UA and GA4:

 

Feature Universal Analytics (UA) GA4
Data Model Session-based Event-based
Ecommerce Structure ec plugin ecommerce object with event names
Reporting Enhanced Ecommerce reports Custom Explorations
Customization Less flexible Highly customizable with parameters

 

Migration Tips:

  • Map your events: UA’s productDetail → GA4’s view_item, addToCartadd_to_cart, purchase remains the same (with a different format).

  • Update your dataLayer: GA4 expects an array called items—even for a single item.

  • Avoid double tracking: Remove old UA ecommerce tags in GTM once GA4 is live.

  • Use parallel tracking during migration: Send data to both UA and GA4 temporarily to validate data consistency.

Local Examples: Pakistani E-Commerce Platforms & PKR Setup

If you're running an ecommerce store in Pakistan, there are specific localization tweaks to consider.

Currency Handling (PKR):

Always include the currency parameter in your ecommerce object:

 

 
currency: "PKR"

 

GA4 supports PKR natively, so your reports will reflect local currency values properly.

Platform-Specific Notes:

  • Shopify (Pakistan stores):
    Use server-side apps or dataLayer push on the thank-you page to fire purchase events.

  • WooCommerce:
    Use plugins like "GTAG for GA4" or manually inject dataLayer in PHP templates.

  • Local CMS platforms:
    Work with your developer to implement dataLayer pushes on key user actions.

Language Considerations:

If your store supports Urdu or bilingual interfaces, pass product names in both languages using a custom parameter like item_name_urdu. Later, this can be used for segmentation or personalization in reports.

Optimization Beyond Setup

Tracking ecommerce events is just the first step. To truly unlock insights and improve conversions, consider these optimization strategies:

Use Item Parameters for Deep Segmentation:

Pass extra item-level data such as:

  • item_brand: Helps analyze brand-level performance

  • item_category: Useful for category-level funnels

  • affiliation: Track revenue by sales channel or store location

Example:

 

items: [{
  item_id: "S123",
  item_name: "Leather Wallet",
  item_brand: "UrbanEdge",
  item_category: "Accessories",
  price: 2999,
  affiliation: "Karachi Flagship Store"
}]

 

Track Promotions and Coupons:

Track internal banners or promotional click events using:

  • view_promotion

  • select_promotion

Add promotion-related parameters like:

 

promotion_id: "SUMMER_SALE_2025",
promotion_name: "Flat 25% Off"

 

This data helps you analyze which promotions drove the most purchases.

Measure Cart Abandonment:

Build funnels in GA4 to see where users drop off:

  • View Product → Add to Cart → Begin Checkout → Purchase

  • Use this insight to run remarketing campaigns via Google Ads or Facebook

Consider Server-Side Tagging:

For more secure and accurate tracking (especially for purchases), move your GA4 tagging to server-side using GTM Server container. This protects your data from ad blockers and improves loading speed.

Conclusion

Setting up Enhanced Ecommerce tracking in GA4 using Google Tag Manager might seem intimidating at first, but once you break it down into manageable steps, it becomes much more approachable even for beginners.

We started by understanding the new event-driven model in GA4, how it differs from Universal Analytics, and why the dataLayer plays such a critical role. From there, we walked through a full setup configuring GTM triggers and GA4 tags, mapping ecommerce events, and testing them using DebugView.

We also tackled common mistakes like missing parameters or duplicate events issues that can seriously compromise your data quality if not caught early.

But tracking isn’t just about getting the data it’s about turning that data into insights. That’s why we explored reporting and funnel building inside GA4, showing you how to use Explorations to uncover where customers drop off and how to improve conversions.

And for those in Pakistan or South Asia, we discussed local considerations: currency (PKR), bilingual content, localized CMSs, and tools tailored for Shopify, WooCommerce, and other popular platforms.

Finally, we looked at how to go beyond the basics tracking promotions, using advanced item-level parameters, and even shifting to server-side tagging for better accuracy and data control.

Key Takeaways:

  • GA4’s ecommerce tracking is built on custom events and parameters—not views and sessions.

  • GTM simplifies implementation, making it easier to manage without touching your site’s core code.

  • The dataLayer is the backbone of all ecommerce tracking. Get this right first.

  • Debug everything using GTM Preview Mode and GA4 DebugView before going live.

  • Optimize your tracking for local audiences, use advanced segmentation, and always aim to turn data into action.

Ready to Implement?

Whether you’re just getting started or migrating from Universal Analytics, this guide gives you the tools and structure to track every meaningful action your customers take on your store.

Comments (0)

No comments yet. Be the first to comment!

Leave a Comment

© 2025 Waqar AzeembyTetraseven