Skip to content

Install on Remix

Remix renders one document from root.tsx: add the tag to that head and every route inherits it.

Remix builds the whole document in app/root.tsx. That is the only file that needs the tag.

Where it goes

Add the script element to the <head> in root.tsx, alongside <Meta /> and <Links />.

app/root.tsx
<head>
  <Meta />
  <Links />
  <script
    defer
    src="https://statsy.co/js/script.js"
    data-website-id="ws_XXXXXXXX"
    data-domain="yourstartup.com"
  />
</head>

Write it as a real element, not with dangerouslySetInnerHTML. React renders the attributes as they are, which is exactly what the script reads.

Confirm it works

Deploy and open the site, then watch Live. Click an internal <Link>: Remix navigates with the History API, so the new route is counted as a pageview automatically.

Error routes render the same document

A route that throws renders your root ErrorBoundary inside the same document, so the tag is still there and the error page is counted like any other pageview. If you want error pages kept out of your reports, exclude their paths under Site settings › Tracking › Excluded paths. See Exclude your own visits and bots.

Last updated · Markdown version