Skip to content
whoisbrowsing

Add whoisbrowsing to SvelteKit

Updated

TL;DR

To add whoisbrowsing to SvelteKit, paste one script tag into src/app.html, the page template every route is rendered into. No package, hook or component is needed.

Using an AI coding agent? Give it this prompt:

Add whoisbrowsing (live visitor view) to this project. Follow https://whoisbrowsing.com/SKILL.md exactly.

By using a script an agent makes for you, you agree to the Terms.

Add the tag to src/app.html

The SvelteKit docs describe src/app.html as your page template, an HTML document with placeholders such as %sveltekit.head% and %sveltekit.body% that SvelteKit fills in for each page (SvelteKit project structure). Add the tag inside <head>, next to the placeholder:

html
<!-- src/app.html -->
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <link rel="icon" href="%sveltekit.assets%/favicon.png" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <script src="https://live.whoisbrowsing.com/s.js" data-site="YOUR_SITE_ID" async></script>
    %sveltekit.head%
  </head>
  <body data-sveltekit-preload-data="hover">
    <div style="display: contents">%sveltekit.body%</div>
  </body>
</html>

Replace YOUR_SITE_ID with your script's ID. No script yet? Get your script. Free. No card, and no account needed.

Paste it on every page of your site, in the <head> or anywhere before </body>. In SvelteKit, that is src/app.html, the template of every page.

Because the tag sits in the template, it is in the server-rendered HTML of every page, and client-side navigation does not remove it.

If you set a CSP nonce

SvelteKit can add a nonce to scripts through %sveltekit.nonce%. If you use a nonce-based policy, add nonce="%sveltekit.nonce%" to the tag, and still add the lines in the CSP section below: the owner panel loads a second file from live.whoisbrowsing.com, and the live connection needs connect-src.

Where to get your script

Get your script: type your website on the home page. If this browser already has a script, the code on this page shows its ID in place of YOUR_SITE_ID.

One script for localhost and production

Use the same script everywhere, so nothing in your code changes when you go live. Add each address you use to it, such as localhost:5173 and yourdomain.com, on the home page (or in your dashboard, if you signed in). Each website gets its own live view, so visitors on localhost:5173 never show up on your real domain. www. and the bare domain are the same website.

SvelteKit apps change pages in the browser without a full reload. You do not need extra code: the script follows client-side route changes on its own, so each page a visitor moves to shows up in your live view.

Content-Security-Policy

If your site sends a Content-Security-Policy header, allow the script and its live connection:

csp
script-src https://live.whoisbrowsing.com;
connect-src wss://live.whoisbrowsing.com;

Add these to your existing script-src and connect-src lists instead of replacing them. Nothing else is needed: the owner panel adds no inline styles, so your style-src can stay strict. If you have no CSP, skip this step.

Verify

Before your visitors see it, add whoisbrowsing to your site's privacy policy (a paragraph to paste), and if the law requires your visitors' consent, get it first: see your responsibilities to your visitors.

  1. Deploy, or run your site locally. Open your site once. If the panel shows there, you're watching. If it doesn't, press Watch your site live on the home page. The home page shows the website as "Installed" once the script has loaded (or "Live now" while someone is there).
  2. To see a visitor arrive, open your site in another tab or window, or press Open a visitor window on the home page. That tab shows up as "you, testing". The tab with the panel is your owner view, and it is never counted.
  3. Move the mouse in the visitor tab. When both tabs are on the same page, its cursor moves in your owner view, and the panel lists it either way.

If nothing shows up:

  • Is the tag in the page source? Search the source for live.whoisbrowsing.com.
  • Is this address in your script's list? The script runs only on the websites listed for it. If it ran on an address that isn't listed, the home page says so and offers to add it.
  • Is something blocking it? A Content-Security-Policy without the lines above, or an ad blocker, can stop live.whoisbrowsing.com.
  • Testing from the EU/EEA, UK or Switzerland, or with Global Privacy Control on? Visitors in the EU, Norway, Iceland, Liechtenstein, the UK and Switzerland, and browsers that send Global Privacy Control, are never shown or counted. In those countries nothing is shown, and nothing is kept on our servers: the script is empty there, and a visitor's live connection from there is refused. Your owner panel doesn't appear either. With Global Privacy Control on (Brave sends it by default), the panel still opens, but your own test tabs don't show.

See how it works for what is sent, and the privacy page for what is never sent or stored.

Remove it

  1. Delete the tag from src/app.html and deploy. Visitors stop showing as soon as the new version is live.
  2. To turn the script off everywhere at once, delete it: open Site details from your script on the home page (or, if you signed in, the script's page in your dashboard), press Delete this script… and confirm with Yes, delete. If the tag stays on a page, the live server refuses it: nothing is shown, and nothing is kept on our servers.

Let your AI agent do it

Claude Code, Cursor or Codex can do this for you. Copy the prompt at the top of this guide with Copy prompt for your AI agent: it points the agent at https://whoisbrowsing.com/SKILL.md, and when this browser already has a script, it hands the agent that script, so no second one is made. The agent puts the tag in the right file for SvelteKit and gives you a watch link. The full walkthrough is in Install with an AI agent.

More install guides

See every platform on the install page, or jump to Next.js and React. To see what the tag does, go to the home page.

See who is on your website, right now

Type your website, paste one line, and watch your visitors live. No account needed.

Free · Under 4 KB · No cookies on your visitors · No data stored about your visitors