You may have already done this in the old Analytics, but in this article I'll show you how to do it in Google Analytics 4 (GA4).
If you want to set up the add to cart and the remove from cart, you need to have two things already working. And those are:
You can do the first one very easily with the help of my blog. For the second one, chances are you'll have to put the developer to work. Send him the following link and you should be fine: https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtag.
Go to Google Tag Manager and click the appropriate account.
Then click on "New tag" and then "New.
Then enter the following information:
Name the tag something similar to: GA4 - Event - add_to_cart
Configuration tag: add the GA4 you use in configuration there.
Event name: add_to_cart
Event parameters: items & {{DLV - ecommerce.items}}.
That will look like this!
Now we move on to the trigger. There, choose 'custom event' and enter add_to_cart.
Setting the remove from cart is basically the same thing, only of course with a different name.
Go to Google Tag Manager and click the appropriate account.
Then click on "New tag" and then "New.
Then enter the following information:
Name the tag something similar to: GA4 - Event - remove_from_cart.
Configuration tag: add the GA4 you use in configuration there.
Event name: remove_from_cart
Event parameters: items & {{DLV - ecommerce.items}}.
Now we move on to the trigger again. There again choose 'custom event' and enter remove_from_cart.
If you have this set up correctly, then you just need to add the events in Google Analytics 4. You do this by going to the appropriate account in Analytics.
Next, click on 'Manage' and then 'events'. Enter both add to cart and remove from cart there as done in the example below.
Once you've done that, you'll see the remove from cart and the add to cart reflected in Google Analytics 4. Check it out!
Written by: Daniel Kuipers
Daniel is the founder of Online Marketing Agency. He constantly scours the Internet for the latest gadgets and tactics and blogs about them in understandable language. Well, sometimes.