Official Jitsu SDK for Angular
Questions?
Links
General
This package is a wrapper around @jitsu/sdk-js
, with added functionality related to Angular.
Installation
To use Jitsu SDK, install npm package
npm install @jitsu/angular
and import Jitsu SDK module to your Angular application.
import { NgxJitsuModule } from '@jitsu/angular';
@NgModule({
imports: [
NgxJitsuModule.forRoot({
tracking_host: "__JITSU_HOST__",
key: "__API_KET__",
}),
],
})
export class AppModule {}
List of all parameters available in the SDK Reference
Usage
@Component({
selector: 'app-root',
template: '<button (click)="onBtnClick(\'test_btn\')">Test button</button>',
})
export class AppComponent implements OnInit {
constructor(private jitsuTracker: NgxJitsuService, private someUserService: SomeUserService) {
router.events
.filter(event => event instanceof NavigationEnd)
.subscribe((event: NavigationEnd) => {
this.jitsuTracker.trackPageView()
});
}
onBtnClick(btnName:string) {
this.jitsuTracker.track('btn_click_event', {btn: btnName})
}
ngOnInit() {
this.someUserService.currentUser.subscribe((user: User) => {
this.jitsuTracker.id({id: user.ID, email: user.EMAIL})
});
}
}
Jitsu SDK parameters and methods
Example app
You can find example app here.