src/index.html · open source (MIT) · ask in plain English

Add analytics to Angular.

Angular is a single-page app driven by the router, so a naive tracker only ever sees the first load. smolanalytics goes into src/index.html as two script tags and autocaptures pageviews, clicks, scroll and JS errors across every router navigation with no service to inject. You ask your numbers in plain English from the dashboard or your editor.

src/index.html
<!-- src/index.html, inside <head> above <app-root> -->
<head>
  <!-- ...existing head... -->
  <script src="https://YOUR-INSTANCE/sdk.js"></script>
  <script>smolanalytics.init("WRITE_KEY", { host: "https://YOUR-INSTANCE" })</script>
</head>

src/index.html is the one document Angular boots into. The tags load before app-root mounts, and autocapture follows RouterModule navigations without extra wiring.

how do I add analytics to angular?

Angular is a single-page app driven by the router, so a naive tracker only ever sees the first load. smolanalytics goes into src/index.html as two script tags and autocaptures pageviews, clicks, scroll and JS errors across every router navigation with no service to inject. You ask your numbers in plain English from the dashboard or your editor.

Because Angular apps are single-page, the real questions are which routed views get used, which forms submit, and where clicks go dead inside deeply nested components. Autocapture tracks router navigations as pageviews and records the full element chain on every click plus JS errors, so you skip building a NavigationEnd subscription or an analytics service. For domain events, call smolanalytics.track("lead_created") from a component or effect, and identify(userId) after login.

It fits Angular because it needs no module, no provider, and no DI. One install in index.html covers the whole app. It is a single open-source Go binary, self-host free or hosted from 29 dollars a month, cookieless so there is no consent banner to manage, and answers come back as deterministic reports a CI test guarantees are real.

Honest pricing: 14-day full trial, no credit card. Then Solo $29/mo, never metered on seats or sites. Overage is $5/million with an emailed receipt, the dashboard never locks, and self-hosting the single Go binary is free forever (MIT).

Add analytics to Angular tonight.

One snippet, or one endpoint. Tomorrow morning the verdict tells you which part of the funnel to fix.

questions

How do I add analytics to Angular?
Angular is a single-page app driven by the router, so a naive tracker only ever sees the first load. smolanalytics goes into src/index.html as two script tags and autocaptures pageviews, clicks, scroll and JS errors across every router navigation with no service to inject. You ask your numbers in plain English from the dashboard or your editor.
Do I need a cookie banner?
Not in cookieless mode. smolanalytics can run without storing anything on the device, so there is no consent banner to add. You still get visitors, referrers, funnels, retention, and paths, and AI-assistant referrals (chatgpt.com, claude.ai, perplexity.ai) show up as their own channel.
Is it enough for a real product, or just page counts?
It does funnels, retention, paths, cohorts, and a daily verdict on what to fix, from the same events, and you ask it in plain English. It deliberately skips session replay, feature flags, and experiments. If you want a straight answer on what to fix, that you own and can self-host free, it fits.

keep reading