DataLook Docs
Install guides

SvelteKit

Install DataLook on SvelteKit — the plain script tag, or the first-party proxy that beats ad blockers. Both on one page.

Add the tag in a root layout <svelte:head>.

Add the script to your root layout

src/routes/+layout.svelte
<svelte:head>  <script defer src="https://cdn.datalook.app/s.js" data-site="YOUR_SITE_ID"></script></svelte:head>

The proxy install serves both s.js and the collector from your own domain, so ad blockers — which match on domain, not path — can't see us. You rewrite one innocuous path prefix to our CDN; the script figures out the rest.

A server hook forwards the prefix to our CDN.

Forward the prefix in hooks.server.ts

src/hooks.server.ts
import type { Handle } from '@sveltejs/kit'const PREFIX = '/_axis'const TARGET = 'https://cdn.datalook.app'export const handle: Handle = async ({ event, resolve }) => {  if (event.url.pathname.startsWith(PREFIX + '/')) {    const target = TARGET + event.url.pathname.slice(PREFIX.length) + event.url.search    const headers = new Headers(event.request.headers)    headers.set('host', new URL(TARGET).host)    headers.set('x-forwarded-for', event.getClientAddress())    return fetch(target, {      method: event.request.method,      headers,      body: event.request.method === 'GET' ? undefined : await event.request.arrayBuffer(),    })  }  return resolve(event)}

Point the script at the prefix

<script defer src="/_axis/s.js" data-site="YOUR_SITE_ID"></script>

Heads up

Your server now sits between the visitor and us, so forward the visitor IP (X-Forwarded-For) or your country breakdown will collapse to your server location. The DNS proxy avoids this entirely — see the proxy overview.