Integrating analytics to your Angular application in an abstract(plug n play) fashion
Taking Countly as an example this time
Jun 12, 2022
Initialisation Factory function
Plugging it in its own module
Tracking declared and realtime events
Tracking page view events injecting this Factory function
For events(operations) which relies on some API response arrival
For pushing error logs to Countly
export class CountlyErrorHandler implements ErrorHandler {
handleError(error: unknown) {
Countly.q.push(['log_error', error]);
console.error(error);
}
}
Final Countly Module
Consuming Countly module in the root module
That’s it for now, I’m open to any queries or feedback, please do comment.