highseat package renders the tracker’s script tag and gives you a typed track(). The tracker loads from cdn.highseat.com, so the install needs no secret and no server code.
Replace YOUR_SITE_ID with your site’s id, which starts with site_. Site settings › Installation in the dashboard shows it, with this code already filled in.
1
Install the package
2
Add it to your root layout
app/layout.tsx
localhost does not complete the install.
Pages Router
Render it in pages/_app.tsx instead of the root layout.pages/_app.tsx
Use an environment variable
Read the site id from NEXT_PUBLIC_HIGHSEAT_SITE, set for the build: Next.js writes it into the page..env
NEXT_PUBLIC_HIGHSEAT_SITE is a build-time variable. Next.js writes its value into the page during next build, so set it in your host’s environment, such as the project settings on Vercel, before the deploy. A variable added after a build takes effect with the next deploy.
Pages that are not found
Next.js loads a missing route as a full page, even when a visitor follows a<Link> to it, so the server answers with a 404 status. The tracker reads that status and records a 404 event with no code from you. Browsers based on Chromium, such as Chrome and Edge, report the status; Firefox and Safari do not.
Content Security Policy
Allow the ingest host in script-src and connect-src.Without the package
Use the package in a Next.js app rather than a script tag in a layout. A<script> tag that React creates in the browser never runs, so a hand-written tag can fail with no error. <Highseat /> adds the tag from outside React.
Next steps
Track events
Send signups and purchases with a typed
track().