Skip to content
Early bird + Black Friday · 73% off

Get ZeroDirs for $179 $49

Claim $49 deal

Click tracking

features.clicks counts a listing’s Visit button: 'ping' beacons from the real link, 'redirect' routes through /out/<id>/, 'off' counts nothing. Every listing has a row id, so it works in every build.

  1. Switch it on.

    site.config.ts
    features: { clicks: 'ping' },
  2. Deploy with pnpm deploy.

  3. Read one listing page’s link.

    Terminal
    curl -s https://<your domain>/<listingBase>/<slug>/ | grep -o 'ping="/out/[^"]*"'

    ping="/out/<id>/"

What to check Where You should see
The endpoint curl -sI https://<your domain>/out/<id>/ | head -1 HTTP/2 405 in ping mode; HTTP/2 302 in redirect mode
A counted click click Visit in a browser, then pnpm exec wrangler d1 execute DB --remote --command "SELECT listing_id, day, count FROM clicks ORDER BY day DESC LIMIT 5" one row per listing per UTC day, count incremented
The stats /admin/stats/ → Top outbound clicks, last 30 days the listing and its count
Popularity after the next build, /search/?sort=popularity or any grid clicked listings sort first
  • ping keeps the real href: a failed write loses the count, not the click.
  • redirect counts in every browser but sends no dofollow.
  • Never counted: HEAD; bot|crawl|spider|slurp|preview|facebookexternalhit|curl|wget; unapproved id (404); wrong content type (400); another origin (403).
  • /admin/stats/ is live; sort order moves only at the next build, whose log line is 30-day clicks for <n>.
  • Past the request quota, tracking fails and nothing alerts you.
State Visitor sees /admin/ reports Fix
'off' (the default) a plain link; /out/<id>/ answers 404 stats: features.clicks is "off", so nothing is counted. set the mode
Firefox in ping mode the link works; the beacon is not sent nothing accept it, or redirect
D1 write fails, or the free-plan quota is spent ping: 204 and the visitor arrives; the count is lost silently clicks: recording a click for listing <id> failed in the Worker log Cost and limits
Redirect mode, the lookup fails 503 “Try again shortly.” the lookup’s own log line retry; consider ping

features.clicks, listing.defaultSort and listing.outboundRel — features, listing.

  • Directorysrc/
    • server/clicks.ts handleOutbound(), the guards, the upsert
    • pages/out/[id].ts the route, every method
    • Directorycomponents/listing/
      • OutLink.astro the anchor in each mode
      • Detail.astro where it renders
    • Directorylib/
      • seo.ts robotsDisallow() adds /out/
      • listing.ts outboundRel(), the sort comparators
      • search.ts the popularity sort on /search/
    • loaders/d1.ts the 30-day aggregate at build time
    • db/schema.ts clicks
    • templates/admin/StatsPage.astro the top-clicks list