DataLook Docs
Install guides

Astro

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

Add an inline script to your base layout head.

Add the script to your <head>

The is:inline directive stops Astro from bundling/processing the tag.

src/layouts/Layout.astro
<script is:inline defer src="https://cdn.datalook.app/s.js" data-site="YOUR_SITE_ID"></script>

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.

Astro middleware forwards the prefix (needs an SSR adapter).

Forward the prefix in middleware

src/middleware.ts
import { defineMiddleware } from 'astro:middleware'const PREFIX = '/_axis'const TARGET = 'https://cdn.datalook.app'export const onRequest = defineMiddleware(async (ctx, next) => {  const { pathname, search } = ctx.url  if (pathname.startsWith(PREFIX + '/')) {    const headers = new Headers(ctx.request.headers)    headers.set('x-forwarded-for', ctx.clientAddress)    return fetch(TARGET + pathname.slice(PREFIX.length) + search, {      method: ctx.request.method,      headers,      body: ctx.request.method === 'GET' ? undefined : await ctx.request.arrayBuffer(),    })  }  return next()})

Point the script at the prefix

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

Heads up

The proxy path needs server-side rendering — set output: "server" (or "hybrid") and an SSR adapter. 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.