NavigationEnd events from the Angular Router.
Do not add the raw Bily script to index.html. The SDK owns script loading for this installation path.
Install Bily
Keep one public configuration value
Add the complete tracking URL to the public environment configuration your Angular build already uses.src/environments/environment.ts
Observe successful navigation
src/app/bily-tracking.service.ts
isPlatformBrowser() keeps initialization out of server rendering. NavigationEnd fires after a successful navigation updates the URL. takeUntilDestroyed() closes the subscription with its injection context.
Start the service once
Inject the service from the root component. Keep the component’s existing imports, template, providers, and application shell.src/app/app.component.ts
Track successful actions
src/app/save-profile.component.ts
Rebuild after a URL change
Angular environment values are normally compiled into browser assets. After Bily validates a customer subdomain, replace the complete value and rebuild every affected target.Verify Angular tracking
Check server rendering, initial load, successful routes, and action events.
Move to first-party tracking
Replace the URL once, rebuild, deploy, and verify the new request.