Integrating analytics to your Angular application in an abstract(plug n play) fashion

Taking Countly as an example this time

Ankit kaushik
Jun 12, 2022
Photo by Justin Morgan on Unsplash

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.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Ankit kaushik
Ankit kaushik

Written by Ankit kaushik

Frontend Tech Lead, Angular Expert

No responses yet

Write a response