I’ve been tasked with adding custom JS tracking code for common events on the site, such as addtocart, login, begincheckout etc. (around 15 in total) for a less commonly used analytics tool (ie. not GA4, Meta etc.)
I’d rather not write unique JS for each different event on which seems painful, time consuming and horrid to maintain. I thought observers – which cover the vast majority of the events i need to track – might be a nice way to do it in a custom module but from reading up on this they are server side only with no easy way to inject the js.
Has anyone had to tackle this and found a neat / clean solution.
Thanks in advance,