← All integration guides

React

Track route changes and product events in React applications.

Create a provider

Initialize the tracker once in a client component mounted near the application root.

useEffect(() => {
  window.analytica?.push(["init", { projectId: "prj_your_app" }]);
}, []);

Track navigation

Call pageview when your router changes location. The built-in tracker can also observe standard history changes.

Use path goals for important routes (for example /onboarding/done) and track() for button-level conversions that power Goals and Funnel steps.

window.analytica?.push(["track", "checkout_started", { cart_total: 49 }]);