Dispose the tracking manager
Get a provider from the providers object
After dispose has been called, this method returns true. Use this method to determine whether dispose() should be run again.
Remove a provider from the providers object
Loop through all the providers and trigger an event
Loop through all the providers and trigger a page view
Generated using TypeDoc
This class is used to wrap all the tracking providers so you can easily add multiple analytics providers to your site. Use the addProvider method add them while constructing this class.
All tracking providers log the events with debug (https://www.npmjs.com/package/debug), to view the logs you have to update your local storage by running this in the console:
To disable the logs run the following in your console
Example usage:
const trackingManager = new TrackingManager({ providers: { ga: new GoogleAnalyticsTrackingProvider({ trackingId: 'UA-XXXXXXX', }), fbq: new FacebookTrackingPixelProvider({ trackingPixelId: 'XXXXXXXXXX', }), } }); trackingManager.trackEvent({ ga: { label: 'Purchase', category: 'shop' }, fbq: { event: 'Purchase', }, });
TrackingManager