Via index.html
The quickest way: add the script tosrc/index.html before </body>:
src/index.html
Via service
For more control, inject the tracker from your rootAppComponent:
src/app/app.component.ts
The
isPlatformBrowser guard makes this SSR-safe if you use Angular Universal.Verify
Deploy and open your app in a browser. Check your OpenRevenue dashboard: a pageview should appear within seconds.OpenRevenue ignores
localhost automatically. Test on your deployed URL.