Agent setup: authorize Sight MCP and ask your agent to call
get_tracking_setup. It configures this integration automatically.
React Router
Sight analytics for React
Router. Thin wrapper around
@sightapp/analytics — same
init/track API.
Install
@sightapp/analytics isn't published to npm yet — until it ships, point
your lockfile at the local checkout instead:
Usage
Render once, near the root of your router:
Custom events, anywhere:
How SPA navigation is tracked
init() patches history.pushState and fires a pageview on every call.
React Router's createBrowserHistory (used by <BrowserRouter> and
createBrowserRouter/RouterProvider) is built directly on the native
History API, so every client-side navigation already routes through
pushState/replaceState — no separate useLocation-based tracking
here, since that would double-count every navigation on top of the
patch. This is well-documented React Router behavior for the standard
browser setup, not an untested assumption.
Doesn't apply if you're using a non-browser history —
createMemoryRouter (tests) or React Native (see
@sightapp/react-native
instead) don't have a window.history to patch.