> For the complete documentation index, see [llms.txt](https://docs.humblytics.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.humblytics.com/how-to-get-started/react-router.md).

# React Router

Add Humblytics to your React Router app in about 5 minutes.

{% hint style="info" %}
**You need:** access to your app's HTML shell or root route and a production deploy. A local dev server won't verify.
{% endhint %}

## 1. Copy your tracking code

In Humblytics, open **Site settings → Install** and click **Copy tracking code**.

## 2. Add it once, in the `<head>`

Load the script once for the whole app. Humblytics tracks route changes on its own, so you don't need any code in your routes.

| Setup                                     | Where to paste                                     |
| ----------------------------------------- | -------------------------------------------------- |
| Vite + React Router (SPA)                 | `index.html` in the project root, before `</head>` |
| Create React App                          | `public/index.html`, before `</head>`              |
| React Router v7 framework mode (or Remix) | The `<head>` in `app/root.tsx` (see below)         |

In `app/root.tsx`, JSX needs the inline script as a string. Replace `YOUR_ID` with the ID from your snippet:

```tsx
<head>
  <Meta />
  <Links />
  <script
    dangerouslySetInnerHTML={{
      __html:
        "document.documentElement.style.opacity='0';window._hmblReveal=function(){document.documentElement.style.opacity='1'};setTimeout(window._hmblReveal,2000);",
    }}
  />
  <script async src="https://app.humblytics.com/hmbl.min.js?id=YOUR_ID" />
</head>
```

## 3. Deploy and verify

1. Deploy to production.
2. Back in Humblytics, click **Verify install**.
3. Open your live site in a private window and click around. Your visit appears in **Observe → Analytics → Overview** under **Live Activity** within about a minute.

**Not verifying?** Test the production build, and make sure the script is in the HTML shell, not inside a component that mounts later.

Still stuck? See [Verify & Troubleshoot Tracking](/how-to-get-started/verify-and-troubleshoot-tracking.md).
