Skip to content

GA4 add_to_cart event not working: why the report is empty

Guide/ 11 min read

Why GA4 says nobody adds to cart while orders keep coming, and the exact add_to_cart code for gtag and dataLayer, tested and checked in DebugView.

  • Analytics
  • JavaScript
In this article (8)
  1. Why the add_to_cart report is empty
  2. Exact GA4 ecommerce event names
  3. Parameters: currency, value and items
  4. add_to_cart example with gtag and with dataLayer
  5. How to validate add_to_cart in DebugView
  6. Common mistakes
  7. Frequently asked questions
  8. Checklist

When the GA4 add_to_cart event is not working, the report says nobody adds to cart while orders keep coming in. The cause is almost always on your side: a misspelt event name, a missing currency, value or items, or a tag that never fires. Send the exact name with its parameters and confirm it in DebugView first.

This post covers the exact ecommerce event names, what each parameter needs, working code for both gtag.js and the dataLayer, and the order to validate it in. I ran every snippet in Chromium against a local dataLayer with all Google traffic blocked, so what you see is exactly what ends up on the page. If shoppers drop off before they ever reach the cart, start with the slow hero image; the next step of the funnel is the mobile checkout form.

Why the add_to_cart report is empty

An add_to_cart that never shows up is rarely a GA4 bug. It is one of these five things, and they are worth ruling out in this order:

  1. The name is not exactly add_to_cart. Per the event naming rules, event names are case sensitive: my_event and My_Event are two different events. addToCart or add_to_card throw no error; they arrive as custom events that the ecommerce reports ignore.
  2. Parameters are missing. The recommended events reference marks items as required on add_to_cart, and currency as required as soon as you send value.
  3. The tag never fires. In Tag Manager, the trigger waits for one specific event name. If your code pushes a different one, nothing happens and nothing complains.
  4. You are looking too early. Google's data freshness page says processing can take 24 to 48 hours. Realtime takes a few minutes and DebugView takes seconds.
  5. Consent hides it. The DebugView help notes that events will not show if privacy controls are set, or if consent mode is active without Analytics cookie consent. Accept the cookies while you test.
the same click, two event namesclick on “Add to cart”a made-up nameaddToCartAdd_To_Cartadd_to_cardAddToCartthe exact nameadd_to_cartlowercase, underscoresarrives as a custom eventecommerce reports ignore ita recommended ecommerce eventecommerce reports read itGA4 is case sensitive: add_to_cart is not addToCarta misspelt name throws no error: the event arrives, the report stays empty

Scroll the figure sideways to see all of it

The first three are visible in the browser before anything reaches GA4. That is why the validation below starts in the console, not in the reports.

Exact GA4 ecommerce event names

The GA4 ecommerce guide groups the events by the step of the purchase. These are the main ones, with what the reference marks as required:

EventWhen to send itRequired
view_item_listA list of products is shown, such as a collectionitems
select_itemA product is picked from that listitems
view_itemA product page is vieweditems; currency if you send value
add_to_cartA product is added to the cartitems; currency if you send value
remove_from_cartA product is removed from the cartitems; currency if you send value
view_cartThe cart is vieweditems; currency if you send value
begin_checkoutCheckout startsitems; currency if you send value
add_shipping_infoShipping details are submitteditems; currency if you send value
add_payment_infoPayment details are submitteditems; currency if you send value
purchaseThe order is completedtransaction_id, items; currency if you send value
refundAn order is refundedtransaction_id; currency if you send value

Every name is lowercase with underscores. Copy them from this table instead of typing them from memory and the most common cause is gone.

Parameters: currency, value and items

The three add_to_cart parameters have specific rules in the reference:

  • currency: a three-letter ISO 4217 code such as "USD". If you send value, it is required for revenue to be computed correctly. "$" or "dollars" will not do.
  • value: a number, not a string. Google asks for the sum of price × quantity across everything in items, without shipping or tax.
  • items: an array with one object per product. Each object needs item_id or item_name, and the guide recommends sending both. price is the unit price, and if you leave out quantity, GA4 counts 1.
one add_to_cart event, part by partdataLayer.push({event: "add_to_cart",ecommerce: {currency: "USD",value: 48,items: [{item_id: "MUG-001",item_name: "Ceramic mug",price: 24,quantity: 2 }]}});the exact name, lowercasedataLayer only; gtag skips itISO 4217; required with valuesum of price × quantity,no shipping, no taxneeds item_id or item_nameno quantity means 1items is required on add_to_cartbefore each push, dataLayer.push({ ecommerce: null }) clears the last one

Scroll the figure sideways to see all of it

There are more item parameters (item_brand, item_category, item_variant, coupon, discount and so on). They are optional: add them when you have the data, but they are never the reason a report is empty.

add_to_cart example with gtag and with dataLayer

Use one of the two for each event, depending on how the tag is installed. If your site loads gtag.js directly, use the first; if it runs Google Tag Manager, use the second. Products and prices are illustrative.

With gtag.js

gtag("event", "add_to_cart", {
  currency: "USD",
  value: 48,
  items: [
    {
      item_id: "MUG-001",
      item_name: "Ceramic mug",
      price: 24,
      quantity: 2,
    },
  ],
});
  1. gtag("event", "add_to_cart", {…}): the first argument says this is an event; the second is its exact name.
  2. currency: "USD": the currency sits at event level, not inside each item.
  3. value: 48: two mugs at 24, as a number. No quotes, no dollar sign, no shipping.
  4. items: [ … ]: one object per product, even when only one is added.
  5. item_id and item_name: the SKU and the name you want in the item reports.
  6. price and quantity: unit price and count. Their product must equal value.

With the dataLayer and Google Tag Manager

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

function trackAddToCart(product, quantity) {
  window.dataLayer.push({ ecommerce: null }); // clear the previous ecommerce object
  window.dataLayer.push({
    event: "add_to_cart",
    ecommerce: {
      currency: "USD",
      value: product.price * quantity,
      items: [
        {
          item_id: product.sku,
          item_name: product.name,
          price: product.price,
          quantity: quantity,
        },
      ],
    },
  });
}

// Call it once your cart confirms the item was added, not on the click:
trackAddToCart({ sku: "MUG-001", name: "Ceramic mug", price: 24 }, 2);
  1. window.dataLayer = window.dataLayer || [];: creates the data layer if it does not exist yet, without wiping what is already there. The data layer docs say to instantiate it this way once per page and never reassign it.
  2. dataLayer.push({ ecommerce: null }): Google puts this before every ecommerce event in its Tag Manager examples to clear the previous ecommerce object. Without it, data from an earlier event on the same page can bleed into this one.
  3. event: "add_to_cart": the name the Tag Manager trigger listens for. It has to match character for character.
  4. ecommerce: { … }: in the dataLayer the parameters live inside ecommerce; with gtag they sit at the top level.
  5. value: product.price * quantity: computed from the same data as items, so the two can never disagree.
  6. The last line is the call. Put it where your cart confirms the product went in (your API's or theme's response), not on the button click: a failed click is not an added product.

In Tag Manager, the tag that picks this up is a "Google Analytics: GA4 Event" tag with the event name add_to_cart. Under More Settings › Ecommerce, tick Send Ecommerce data and pick Data Layer as the source. The trigger is a Custom Event named add_to_cart. That is how the Tag Manager version of the ecommerce guide sets it up.

In my test, with the real gtag.js and Tag Manager loaders on the page but their requests blocked, the dataLayer ended with exactly these objects: one { ecommerce: null } and the event with value: 48 and a single item. No request reached Google.

How to validate add_to_cart in DebugView

Validate from the inside out: first what is on your page, then what GA4 receives, and the reports last.

from your site to the report: where to look, in orderconsoledataLayerpush there?Tag Assistantpreviewtag fired?DebugViewdebug_modewith items?reports24–48 hfinal numberssecondshoursDebugViewturn on: gtag("config", "G-XXXXXXXXXX", { debug_mode: true })or Tag Assistant / Tag Manager previewturn off: remove debug_mode; false keeps it onbrowser first, then GA4if the event is not in the console, do not look in GA4: your site is failing

Scroll the figure sideways to see all of it

1. In the browser console

Add a product to the cart, open the developer tools and paste this into the console:

dataLayer.filter((e) => e.event === "add_to_cart" || e[1] === "add_to_cart");
  • e.event === "add_to_cart" finds dataLayer pushes.
  • e[1] === "add_to_cart" finds gtag calls, which are stored as an arguments list.
  • An empty array means the problem is on your site: the code never ran or it uses another name. GA4 cannot show something that never left the page.

2. In Tag Assistant or Tag Manager preview

Open your site through tagassistant.google.com or Tag Manager's preview mode. It shows whether the GA4 tag fired on the event, and with which parameters. If the push is in the console but the tag does not fire, check the trigger's event name.

3. In DebugView

Per the DebugView help page, Tag Assistant and Tag Manager preview turn on debug mode for your own device. With gtag you can also turn it on for the whole site:

gtag("config", "G-XXXXXXXXXX", { debug_mode: true });
  • G-XXXXXXXXXX is your web stream's measurement ID.
  • debug_mode: true on config flags every event on that page; to flag a single one, put the parameter on that event call instead.
  • To turn it off, remove the parameter. Setting it to false does not disable it.

Then go to Admin › Data display › DebugView. The seconds stream shows what arrived in the last minute. Click add_to_cart and check it carries currency, value and items with your products. If you tested on several devices, pick yours in the device selector.

4. In the reports

Once DebugView looks right, the Realtime report should show the event within minutes. Standard reports can take 24 to 48 hours. If it is still empty after two days and DebugView was fine, check consent and your property's data filters.

Common mistakes

  • Typing the name from memory. addToCart, Add_To_Cart and add_to_card all reach GA4 without an error, as custom events. Copy the name from the reference.
  • Sending value as a string. "$48.00" is a string. Send 48, and put the currency in currency.
  • Sending value without currency. The reference requires it whenever value is set.
  • An empty items. It is required, and every item needs item_id or item_name.
  • Skipping { ecommerce: null }. Without it, ecommerce events on the same page can mix in Tag Manager.
  • Firing on the click. If the product does not go in (out of stock, network error), you count an add_to_cart that never happened.
  • Two implementations at once. According to Shopify's help center, GA4 is connected through the Google & YouTube sales channel and some ecommerce events are tracked automatically. If you paste your own code on top, check in DebugView that one click does not send two add_to_cart events.
  • Leaving debug_mode: false to switch it off. It stays on; remove the parameter instead.

Frequently asked questions

How long does add_to_cart take to show in GA4?

Seconds in DebugView and a few minutes in Realtime. For standard reports, Google says processing can take 24 to 48 hours, so do not judge a fix in those reports on the day you ship it.

Can I use my own event name?

You can, and GA4 stores it as a custom event. But the ecommerce reports are built on the recommended names. For the cart, the name is add_to_cart and there is no alternative.

Should I use gtag or the dataLayer?

It depends on how the tag is loaded. With gtag.js on the page, call gtag("event", …). With Google Tag Manager, push to the dataLayer and let a GA4 tag send it. Do not send the same event both ways, or it gets counted twice.

Does my Shopify store need this code?

If you connected GA4 through the Google & YouTube channel, Shopify already tracks some ecommerce events. Before writing anything, add a product with DebugView open: if add_to_cart already arrives correctly, do not duplicate it. This code is for custom storefronts, themes with a custom cart, or events the channel does not send.

Checklist

  • The name is exactly add_to_cart, copied from the reference.
  • currency is a three-letter code and is present whenever value is.
  • value is a number equal to the sum of price × quantity, without shipping or tax.
  • items has one object per product, each with item_id or item_name.
  • With the dataLayer, every event is preceded by { ecommerce: null }.
  • The event fires when the cart confirms, not on the click.
  • The console shows the push and Tag Assistant shows the tag firing.
  • DebugView shows add_to_cart with its three parameters.
  • No two implementations send the same event.

Measuring the cart correctly is step one; step two is giving shoppers fewer reasons to leave it. If the button is slow to respond, see the slow add-to-cart button; if the page is slow to appear, the hero image that holds back LCP; and if they leave while paying on a phone, the attributes that fix a mobile checkout form. With data you can trust, CRO stops being guesswork.

Saw this on Instagram? Comment GA4 on the Reel and I'll send you the guide.

Written by

Luis Morales

Luis Morales

Frontend and Shopify developer, EcomLabs

@luismoralesdev on Instagram

Published October 30, 2026 · updated November 1, 2026

← Blog