src/app.html, the HTML template of every page. Replace pk_xxxx with your project key.
src/app.html
Alternative: svelte:head in the root layout
Use this version when you want to read the project key from an environment variable. The{#if} block skips the script when the key is empty. It sits inside <svelte:head>, because Svelte does not allow <svelte:head> inside a block.
src/routes/+layout.svelte
Keep the key out of development
With the layout version, 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.PUBLIC_ to the browser, through $env/static/public. Keep the empty line in .env: the import fails at build time if the variable is not declared at all.
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.