Provider: Mixpanel
Setup
1. Add Mixpanel Snippet
Add the tracking code provided by Mixpanel to your index.html file, typically before the closing </head> tag.
2. Configure Angulartics2
In your root component (e.g., app.component.ts), inject Angulartics2Mixpanel and call startTracking().
import { Component } from '@angular/core';
import { Angulartics2Mixpanel } from 'angulartics2';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
})
export class AppComponent {
constructor(angulartics2Mixpanel: Angulartics2Mixpanel) {
angulartics2Mixpanel.startTracking();
}
}
This will activate automatic page tracking and enable other tracking methods for Mixpanel.
Specific Mixpanel Features
Angulartics2 supports several Mixpanel-specific features through its API:
setUsername(userId): Callsmixpanel.identify(userId).setUserProperties(properties): Callsmixpanel.people.set(properties).setUserPropertiesOnce(properties): Callsmixpanel.people.set_once(properties).setSuperProperties(properties): Callsmixpanel.register(properties).setSuperPropertiesOnce(properties): Callsmixpanel.register_once(properties).setAlias(alias): Callsmixpanel.alias(alias).