Hey,
I’m currently building a tracking software for Shopify stores.
I want to provide a JS script that will track the actions visitors perform on the store. This script will be added to their theme.liquid page.
The issue I’m facing is that I do not know how to universally track add-to-cart clicks. In general, it would be pretty easy to just add the tracking function in the onClick of the add to cart button but the issue is that I do not know how to do that from the JS tracking script. I would need to know the ID of the add to cart button.
But since this JS tracking script that I want to provide should work on any store/theme there is no way for me to know the ID of the add-to-cart button.
Does anybody know a way around this? Should I use something like Google Tag Manager? Or is there a way in Shopify to identify the add-to-cart button?
I would really appreciate your help on this ![]()
Kind regards,
Noah