How To Track Add-To-Cart Clicks In Google Analytics

A disproportionately large number of eCommerce sites have “add-to-cart” buttons which are not actually tracked by Google Analytics (you may check a sample of travel bags ecommerce website done by us). Though information on the number of users you added a product to the cart comparing with number of those who completed purchase is very valuable for any marketer. For this reason, we refer to add-to-cart buttons as custom Google Analytics events that you yourself need to find a way of tracking. Let’s take a look at how to do this.

Why Do I Need Ecommerce Data Analytics To Track Add To Cart GA?

Ecommerce data analytics are super important if you want to optimize conversions and improve your websites. Conversions can be further boosted by tracking when a potential customer adds an item to their cart. Such tracking gives you crucial information that informs you can divide your visitors between folk who are adding stuff to their cart but not checking out and folk who are viewing products without adding anything to their cart. As mentioned, Google Analytics doesn’t automatically track these kinds of clicks. There are a number of third party shopping cart providers that track this google analytics events – but most don’t.

hire eCommerce developers

Track Add To Cart Events: Step-By-Step Guide To Google Analytics E-Commerce Tracking

Step 1

On contrary to old versions of Google Tag Manager, there is no need to create a tag for click listener now – it’s already built-in. Let’s assume your CSS class is “button btn-cart” (usually it is on all ecommerce websites), so all you need to do is to ensure Click Classes variable is enabled. For this you go to Variables in the left panel and make sure Click Classes is checked.

Variables in Google Tag Manager

Step 2

Next, you need to identify your Add to Cart button. Find a product page and find the Add to Cart button. Right-click it before selecting Inspect Element In Chrome. A window will pop up. Here you need to copy the CSS class “button btn-cart” of the HTML element, before heading back to GTM.

Add To Cart Clicks In Google Analytics

Step 3

It’s now time to create a rule where an add to cart GA event is only recorded when a visitor clicks the “button btn-cart” HTML element. For this you go to the Triggers menu in Google Tag Manager.

  • Select Triggers – New, give it a name
  • Select Click in Event
  • Leave All elements in Configure Trigger
  • Select Some Clicks
  • In Fire On section select Click Classes equals button btn-cart

Step 4

You’re almost done. All you need to do now is create the add to basket google analytics tag that will record this particular google analytics event. To do this:

  • New – Tag
  • Product – Google Analytics – Universal Analytics (this is your tag type)
  • Add to cart (this is your firing rules)
  • Tracking ID: paste your Google Analytics tracking ID here
  • If your tracking code supports demographics and interests reports, check “Enable Display Advertising Features.”
  • Track Type – Event
  • Choose a category, action and label. You action should be Click and your label should be {{url}}
  • Then save, before testing and checking the results!

Tag Creation in Google Tag Manager

Once all steps are done, you should start noticing new Events in Behavior reports. Please note that events will be written only since the date when tracking was enabled and it won’t affect the data your Google Analytics had prior to this date. If you need any help with setting proper tracking on your website, feel free to contact our team for professional assistance.

Hire Dedicated Ecommerce Developers at Mobilunity
checklist to hire eCommerce web site developer

Mobilunity offers services of professional ecommerce developers, who can solve variety of issues: from setting proper Google Analytics tracking for add to cart clicks to providing on-demand bugfix on websites. Feel free to request a quote today and we will start searching for the perfect engineer for you based on your job description.

advantages and disadvantages of outsourcing development to Mobilunity

Start building your dedicated team of ecommerce developers with Mobilunity! Request a quote today!

Request a quote

We will contact you as soon as posible.

Attach File (max file size 5MB; allowed extensions: doc, txt, pdf, docx)

Your email address will not be published. Required fields are marked *

Contact us Request a Quote

Your email address will not be published.

Required fields are marked *

Attach File

(max file size 5MB; allowed extensions: doc, txt, pdf, docx)

subscribe to newsletter

Your email address will not be published.

Required fields are marked *

Ask a Question

Your email address will not be published.

Required fields are marked *

Sorry, this page isn't quite ready yet

redirecting to the old site



cannot account for customer alterations, as the site may reflect changes made after the project was completed.

Mobilunity - Dedicated Developers