React apps usually load PureStats once in the HTML shell.

## Vite or Create React App

Add the script to `index.html`:

```html
<div id="root"></div>
<script defer src="https://purestats.io/pf.js" data-domain="example.com"></script>
```

The tracker will capture the initial pageview and listen for history changes created by common routers.

## React Router

For most React Router apps, no extra code is required. If your app uses memory routing or custom navigation that does not update the browser URL, manually trigger a pageview:

```js
window.purestats?.trackPageview();
```

Call it after the visible route changes.

## Custom events

Use JavaScript events for product interactions that are not pageviews:

```js
window.purestats?.track('Signup Started', {
  plan: 'pro',
  location: 'pricing'
});
```

For simple buttons or forms, no-code events may be easier to maintain.

## Development mode

Avoid tracking local development unless you deliberately add `localhost` as an alias for testing. Production builds should use the real configured domain.
