Skip to main content
The proxy is an Astro endpoint whose file name is your proxy path. Read how the proxy works first if you have not set one up before. Replace YOUR_SITE_ID and YOUR_PROXY_PATH with your own values. Site settings › Installation shows both, with this code already filled in. Generate the site secret there too.
1

Install the package

2

Add the environment variables

In .env. The file name carries the path, so the endpoint needs only the secret.
.env
3

Add the proxy endpoint

Needs a server adapter. A static site uses its host’s function instead, such as Cloudflare Pages. On the Cloudflare adapter, pass secret: locals.runtime.env.HIGHSEAT_SECRET. clientAddress is the address that connected, so behind a proxied Cloudflare record, use “cloudflare” instead.
src/pages/YOUR_PROXY_PATH.ts
4

Load the tracker from the path

In your layout’s <head>, in place of the tag that loads from Highseat.
src/layouts/Layout.astro
Deploy, then check the proxy. The card in Installation settings turns green when an event arrives through it.

A server adapter is required

The endpoint sets prerender = false and answers on demand, so the site needs a server adapter, such as @astrojs/node or @astrojs/vercel. A fully static site has no server to run it on. Use your host’s functions instead, such as Cloudflare Pages.

Behind Cloudflare

clientAddress is the address that connected to your server. Behind a proxied Cloudflare record, that is a Cloudflare address, so pass clientIp: "cloudflare" instead. On the Cloudflare adapter, the secret is not in process.env. Pass it from the runtime: secret: locals.runtime.env.HIGHSEAT_SECRET.

The path is a file name

The file name carries the path, so the endpoint needs no HIGHSEAT_PATH. When you rotate the path, rename the file and update the script tag.