Add analytics to Qwik.
Qwik is resumable and ships near-zero JS until you interact, so bolting on a heavy analytics SDK defeats the point. smolanalytics is two small script tags in the head of src/root.tsx, autocapturing pageviews, clicks, scroll and JS errors with no code. You ask your numbers in plain English instead of hand-instrumenting a lazily-hydrated app.
// src/root.tsx, inside the <head> of the Root component
<head>
<meta charSet="utf-8" />
<RouterHead />
<script src="https://YOUR-INSTANCE/sdk.js"></script>
<script
dangerouslySetInnerHTML={`smolanalytics.init("WRITE_KEY", { host: "https://YOUR-INSTANCE" })`}
></script>
</head>src/root.tsx holds the document head for every Qwik City route. Qwik's dangerouslySetInnerHTML takes the string directly, so the init runs on load.
how do I add analytics to qwik?
Qwik is resumable and ships near-zero JS until you interact, so bolting on a heavy analytics SDK defeats the point. smolanalytics is two small script tags in the head of src/root.tsx, autocapturing pageviews, clicks, scroll and JS errors with no code. You ask your numbers in plain English instead of hand-instrumenting a lazily-hydrated app.
Qwik's whole pitch is resumability, so the metric that matters most is whether interactions actually fire on those lazily-loaded chunks. Autocapture gives you clicks with the full element chain, scroll depth, and JS errors from code that only downloads on demand, which is exactly where a resumable app tends to hide breakage. For business events, call smolanalytics.track("signup") inside your event handler and identify(userId) after login.
It fits Qwik because it is a plain script tag, not a framework integration that would force eager hydration. It loads once from root.tsx and stays out of the resume path. It is one open-source Go binary, self-host free or hosted from 29 dollars a month, cookieless with no consent banner, and every report is deterministic and proven by a CI test not to be hallucinated.
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 Qwik tonight.
One snippet, or one endpoint. Tomorrow morning the verdict tells you which part of the funnel to fix.