Catch cart events in Javascript layer


#1

I need to catch events like:

Add to cart
Remove from cart
Visit product
Visit category
Change quantity of products in cart
And other checkout steps.

This events should be send via JavaScript library.
Is any pattern how I should do it?


#2

Why do you want it to be done via JavaScript where there are such events in the PHP code?


#3

My marketing automation provider require this way. I need to use special JS library which consist methos like library.addToCart(…) etc.


#4

Have a look to https://github.com/stefandoorn/google-tag-manager-enhanced-ecommerce-plugin - there are already implemented this features for Google Tag Manager.