...
@NgModule(
{
imports [..., NgAnalyticsModule]
...
}
)
...
constructor(ngAnalytics: NgAnalytics)
this.ngAnalytics.support([new NgAnalyticsGoogle(), new NgAnalyticsMixPanel()])
this.ngAnalytics.track('event', {eventCategory: 'video', eventAction: 'first play'})
export class MyCustomAnalytics implements NgAnalyticsInterface {
....
}
this.ngAnalytics.support([...,new MyCustomAnalytics()]);
<button ngaTrack="event"
[ngaTriggerEvent]="['click', 'mouseover']"
[ngaProperties]="{eventCategory: 'button', eventAction: 'clicked or mouseover'}">
</button>
if (click || mouseover) {
this.ngAnalytics.track("event", {eventCategory: 'button', eventAction: 'clicked or mouseover'});
}
MIT