For the event tracking, I did something similar at Accordo. So, I would like to share my thoughts about the tracking design at FE:
- Encapsulate an EventTracking class for the common fields and the API call. Pseudocode may like follow:
class EventTracking {
fields = {};
constructor() {
// Init evn related configs and common fields