Documentation menu

Install on React (Vite / CRA)

Add Open Analytics to a React (Vite / CRA) site: where the snippet goes and how to verify it.

The short way

From your project folder, let the CLI detect React (Vite / CRA) and place the snippet itself:

terminal
npx getopen init

It asks for your tracking key (dashboard, your site, Settings, Installation), writes the tag, and prints which file it changed. Prefer to do it by hand? The steps below are what it does.

Manual steps

1. Vite and Create React App render into a static HTML shell; the snippet goes into its <head>.

index.html (Vite) or public/index.html (CRA)
<script
  async
  src="https://c.getopen.so/oa.js"
  data-key="YOUR_TRACKING_KEY"
  data-collector="https://c.getopen.so"
></script>

2. If you use React Router, route changes are tracked automatically; nothing to wire.

3. Deploy (or run your dev server) and open the site once. The realtime view in your dashboard shows the visit within seconds; historical charts fill moments later.

Next

Route changes in a single-page app are tracked automatically, and the snippet never needs editing for updates. From here: custom events for the actions you care about, or script options for test mode and the privacy attributes.