Angulartics2: Omnichannel Analytics for Angular
Welcome to Angulartics2, the vendor-agnostic analytics library for Angular applications. Angulartics2 provides a unified API to track user interactions—such as page views, clicks, and other custom events—and send them to a wide array of analytics providers.
This approach decouples your application's analytics logic from any specific analytics vendor, making it easy to switch, add, or remove providers without changing your codebase.
The Problem Solved
Integrating analytics into a modern single-page application (SPA) can be complex. You need to manually track route changes, capture user events, and write vendor-specific code. If you decide to switch analytics providers or use multiple providers simultaneously, you have to refactor significant parts of your application.
Angulartics2 solves this by offering a simple, consistent API that acts as a middleware between your Angular app and the analytics services you use.
Key Features
- Vendor-Agnostic: Write your tracking code once and send it to dozens of supported providers, including Google Analytics, Mixpanel, Segment, and more.
- Automatic Page Tracking: Automatically tracks route changes in your Angular application, sending a
pageviewevent to your configured providers. - Declarative Event Tracking: Use the
angulartics2Ondirective to track clicks and other DOM events directly in your HTML templates. - Programmatic Event Tracking: Inject the
Angulartics2service to track events from your component logic, giving you full control over what and when to track. - Extensible: Don't see your provider on the list? Angulartics2 is designed to be extensible, allowing you to create your own provider plugin.
Getting Started
Ready to integrate analytics into your Angular application? Head over to the Installation guide to get started, or follow the Quick Start tutorial for a hands-on example.