How To Track Add To Cart In Google Analytics

Google Analytics offers a robust way to monitor your website’s effectiveness and the actions of its users. Tracking the “add to cart” event is crucial because it shows when a user has placed a product in their shopping cart. This article will guide you through the process of configuring tracking for the add to cart event within Google Analytics.

Step 1: Create a Custom Dimension

The first step is to create a custom dimension in Google Analytics. This will allow you to track the add to cart event as a separate metric. To do this, go to the Admin section of your Google Analytics account and select “Custom Definitions” from the left-hand menu. Then, click on “Custom Dimensions” and create a new dimension with the name “Add to Cart Event”.

Step 2: Set Up Tracking Code

The next step is to set up tracking code for the add to cart event. To do this, you will need to add some JavaScript code to your website’s checkout page. The code should look something like this:

ga('set', 'dimension1', 'Add to Cart Event');
ga('send', 'event', 'Checkout', 'addToCart', 'Item Name');

In this code, “dimension1” refers to the custom dimension you created in step 1. “Event” is the type of event you are tracking, and “addToCart” is the name of the event. “Item Name” is the name of the item that was added to the cart.

Step 3: Analyze Your Data

Once you have set up tracking for the add to cart event, you can start analyzing your data in Google Analytics. To do this, go to the “Behavior” section of your account and select “Events”. From there, you should be able to see a new event category called “Checkout” with an event action called “addToCart”. You can use this data to track how many users are adding items to their cart, which items are being added, and other important metrics.


Tracking the add to cart event in Google Analytics is an important step for any e-commerce website. By following these steps, you can set up tracking for this event and start analyzing your data to improve your website’s performance and user experience.