pk_xxxx with your project key.
The file is index.html at the root of a Vite project, and public/index.html in a Create React App project.
index.html
Alternative: React Helmet
If your app already manages the document head with React Helmet, add the script there. The condition skips the script when no key is set.src/App.tsx
Alternative: load it from a hook
A hook can add the script to the page when your app starts. It does nothing when the key is missing or when the script is already on the page.src/hooks/useRadar.ts
src/App.tsx
Keep the key out of development
With React Helmet or the hook, store the key in an environment file and leave it empty for development. Without a key, the script is not added to the page, so Radar does not load while you develop.REACT_APP_. With Vite, name the variable VITE_RADAR_PROJECT_KEY and read it with import.meta.env.VITE_RADAR_PROJECT_KEY.
Check that it works
Deploy your site, open the published version, load two pages and click a link. The first event should reach your Radar dashboard within a few seconds. If nothing arrives, follow check your installation. When the tag is added by JavaScript rather than written in the HTML, it does not show in the raw page source: look fortracker.js in the Elements panel of your browser’s developer tools instead.