pk_xxxx with your project key.
The file is index.html at the root of a Vite project, and public/index.html in a Vue CLI project.
index.html
Alternative: your head manager
If your app already manages the document head with a library, add the script there. Both examples skip the script when no key is set.- Vue 3 (useHead)
- Vue 2 (vue-meta)
With
@unhead/vue already set up in your app, call useHead in your root component:src/App.vue
Alternative: load it from a composable
A composable can add the script to the page when your root component mounts. It does nothing when the key is missing or when the script is already on the page.src/composables/useRadar.ts
src/App.vue
Keep the key out of development
With a head manager or the composable, 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.VITE_. With Vue CLI, name the variable VUE_APP_RADAR_PROJECT_KEY and read it with process.env.VUE_APP_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.