Using Analytics to track Add To Cart

I'd like to figure out a way to use Google Analytics to track when someone adds a product to their cart, but I can't figure out how to do it.

I figured I could set up a goal, but since the add to cart button is part of a form and not really a URL, I'm not sure what to put in the goal.

Is there anyway to add some type of tracker or maybe a transparent png or something so that when the button is clicked information is sent to Analytics or something?

Obviously I could put the cart as a goal and then force people to the cart after they add the product, but I don't really want to do that. I just want the add to cart to be an event that can be tracked.

Anyone have any ideas?



You need to use conversion tracking and assign values to various steps in the process. I.e. product detail page view, add to cart, checkout, order completion… Then the Google Conversion tools can tell you what the value is for each step/page. So you use some numeric value that increases for each step in the process.

I don' think Conversion tracking is part of Analytics, but it's been a while since I used this stuff so I don't know for sure what might have changed with Google tracking in general.

You do not have to have conversion tracking setup. As long as cs-cart has analytics installed and in your analytics settings in google e-commerce tracking is setup you can track events and see which event action converts more

To track clicks on add to cart button, add this code to the button

onclick=“_gaq.push(['_trackEvent', 'Product Page', 'Add to cart']);”

This sets a category in analytics Content → Events called Product Page, with an action Add to cart, you can set a category for your Category page add to cart buttons so that in google analytics you can see how many conversions come from the product page vs category page. Funnel views and goals is different. Let me know if you have any questions


Just a note that gaq.push and trackEvents is for the most recent analytics tracking code so make sure to update if you have to otherwise this wont track events

Hi, I know this topic is a little old now, but what file would I have to place this additional code in to make this work correctly.

This topic is definitely old, but we have created very informativew and beautiful infographics on this topic, so it will be great for readers to know how to make proper google analytics ecommerce tracking.