Tech Knowledge

Search
Categories

Angulartics2 – A Powerful Analytics tool for Angular Applications

We’ve created the open-source library Angulartics2 to plug into your Angular single-page app (SPA) for analytics integration. It allows you to do event tracking and it is ready to integrate with Google Analytics, Google Tag Manager, Kissmetrics, Mixpanel, Piwik, Segment, Baidu Analytics and Facebook Pixel. Problem Most analytics providers do not automatically track the browser’s navigation history, making it difficult to track single-page applications (SPAs) like Angular applications. Simple Solution To tackle this problem we developed a simple open-source library called Angulartics2. By plugging Angulartics2 in your Angular apps it will automatically track navigation events and send them to your plugged-in Provider, such as Google Analytics. Angulartics2 also comes with easy ways to send custom events to your providers enabling you to easily send any kind of event such as when your users buy an article or download a file. This is mostly useful for tracking conversion within your apps. Diving into some simple code snippets Plugging Angulartics2 into your Angular app is simple and similar to any other module You have to import Angulartics2Module.forRoot() into your main module and pass an array with the providers you are using. Then, in you main component you need to pass each provider to the component constructor function. And that’s it, you now have automatic page tracking. Make […]