Documentation

Analytics

Set up Highseat for cookieless pageview, event and revenue tracking

Dirstarter ships with Highseat for analytics. Highseat counts pageviews and custom events without cookies, so most sites need no consent banner. It also credits Stripe sales to the visit that started them, which tells you which sources bring paying listings and not only traffic.

Highseat is made by the same developer as Dirstarter, so the integration is kept up to date with every release.

One month free for Dirstarter users

Sign up through this link and your trial runs for 30 days instead of 14. No card is needed to start.

Analytics is optional. Without a Highseat site id the tracker is left out and the rest of the app works as before.

Setup

1. Create a site

  1. Sign up for Highseat and add your domain as a site.
  2. Open Site settings › Installation. It shows the site id, the proxy path and the site secret.
  3. For the visitors chart in the admin dashboard, create a read-only key in Workspace settings › API keys.

2. Environment variables

.env
NEXT_PUBLIC_HIGHSEAT_SITE=site_xxxxxxxxxxxx
HIGHSEAT_PATH=/0123456789
HIGHSEAT_SECRET=hs_secret_xxxxxxxx
HIGHSEAT_API_KEY=hs_live_xxxxxxxx # for the admin dashboard

HIGHSEAT_PATH is read when the app builds, so set it for the build as well as at runtime. HIGHSEAT_PATH and HIGHSEAT_SECRET go together: the proxy refuses to forward events without the secret.

How it works

The tracker

<Highseat /> from the highseat package loads the tracker in app/(web)/layout.tsx. It counts pageviews on every route change, including client-side navigation, with no extra code.

Query params in page URLs

Highseat records the query params listed in allowParams in config/analytics.ts and drops the rest, along with the hash, before an event leaves the browser. Dirstarter lists the params that hold page numbers, sort keys, slugs and fixed values, such as page, sort and category. Free-text search (q), the login redirect (next) and emails stay out, so what visitors type never reaches your stats. Campaign tags (utm_*, ref, source and ad click ids) are always kept.

To see a filter or sort param of your own in Highseat, add its name to allowParams. Leave out any param that can hold free text, a URL, an email or a token.

config/analytics.ts
export const analyticsConfig = {
  allowParams: ["page", "sort", "category", "letter", "dialog", "bookmark", "cancelled", "pricing"],
}

First-party proxy

withHighseat() in next.config.ts rewrites HIGHSEAT_PATH to the route handler in app/api/highseat/route.ts. The tracker script and its events then go through your own domain, on a path no other site shares, so filter lists do not block them. The handler reads the visitor's IP with the same TRUSTED_PROXY rule as the rest of the app, so set TRUSTED_PROXY=cloudflare when your site sits behind a proxied Cloudflare record.

Without HIGHSEAT_PATH the build prints a warning and the tracker loads from Highseat's own host instead.

Signed-in users

The user menu passes the signed-in user's id (never an email) to Highseat, and clears it on sign-out.

Revenue attribution

A listing checkout sends the tracker's attribution id to Stripe as attribution_id metadata. Connect Stripe in Site settings › Revenue (guide) and each sale is credited to the visit, source and campaign that started it.

Custom events

Every event is declared once in types/highseat.ts. The declaration is strict, so a misspelt event name or a wrong property is a type error.

types/highseat.ts
declare module "highseat" {
  interface Register {
    events: {
      submit_tool: { slug: string }
      click_website: { url: string; tier: string; source: string }
      // add your own events here
    }
    strict: true
  }
}

Send an event with the useTrackEvent hook:

import { useTrackEvent } from "~/hooks/use-track-event"

export function SubmitButton() {
  const trackEvent = useTrackEvent()

  return <button onClick={() => trackEvent("submit_tool", { slug: "my-tool" })}>Submit</button>
}

To track an outbound link, pass eventName and eventProps to ExternalLink.

Server-side events

trackServerEvent in services/analytics.ts sends an event from the server, with the same typed names and properties. It needs HIGHSEAT_SECRET, and in development it logs each event to the console instead of sending it. A secret in the wrong format never stops the server: it logs a warning and sends nothing.

The /go/<slug> redirect uses it. Links handed out beyond your site, such as by the public MCP server, point to /go, which records click_website with a source such as mcp and then sends the visitor on.

Built-in events

EventSent when
submit_toolA tool is submitted
subscribe_newsletterSomeone subscribes to the newsletter
start_checkoutA listing checkout starts
click_websiteA visitor opens a tool's website, on your site or through /go
click_adA visitor clicks an ad
click_shareA visitor shares a page

In development, events are logged to the console instead of being sent, so test clicks never reach your stats.

Admin dashboard

With HIGHSEAT_API_KEY set, the admin dashboard shows daily visitors for the last 30 days, the total and the change against the previous period.

Visitors chart

The chart reads Highseat's stats API through getVisitorsByDay in services/analytics.ts. The same API also serves reports such as top pages and sources, so you can add your own queries next to it.

Using another provider

To use a different analytics tool, replace <Highseat /> in the layout, withHighseat() in next.config.ts, the body of useTrackEvent and getVisitorsByDay in services/analytics.ts. Then remove app/api/highseat, types/highseat.ts, the useIdentify call in the user menu and the attribution id in the checkout, or replace them with your tool's equivalents.

Last updated on

On this page

Join hundreds of directory builders

Build your directory, launch, earn

Don't waste time on Stripe subscriptions or designing a pricing section. Get started today with our battle-tested stack and built-in monetization features.

Get Lifetime Access
30-day money-back guarantee