init() in ngOnInit of your root AppComponent:
history.pushState — no router hooks needed.
Adding user identity
Inject your auth service and callidentify() once the user is resolved:
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Install Tracelit in an Angular project by calling init() in AppComponent’s ngOnInit lifecycle hook.
npm install @tracelit/tracker
init() in ngOnInit of your root AppComponent:
// src/app/app.component.ts
import { Component, OnInit } from '@angular/core'
import { init } from '@tracelit/tracker'
@Component({
selector: 'app-root',
templateUrl: './app.component.html'
})
export class AppComponent implements OnInit {
ngOnInit() {
init({ token: 'YOUR_TOKEN_HERE', environment: 'production' })
}
}
environment. Only "production" and "development" are accepted. If omitted, events default to development.history.pushState — no router hooks needed.
identify() once the user is resolved:
// src/app/app.component.ts
import { Component, OnInit } from '@angular/core'
import { init, identify, reset } from '@tracelit/tracker'
import { AuthService } from './auth.service'
@Component({
selector: 'app-root',
templateUrl: './app.component.html'
})
export class AppComponent implements OnInit {
constructor(private auth: AuthService) {}
ngOnInit() {
init({ token: 'YOUR_TOKEN_HERE', environment: 'production' })
this.auth.user$.subscribe(user => {
if (user) identify(user.id, { email: user.email, plan: user.plan })
else reset()
})
}
}
Install Tracelit in my Angular project.
Initialize @tracelit/tracker in AppComponent ngOnInit with:
init({ token: 'YOUR_TOKEN_HERE', environment: 'production' })
Make minimal edits, show changed files, and provide a short verification checklist.