NGU-Web/docs/redirects.md
Zaldimmar 6289e7203f Links/redirects: /go/ short links with click counts, Plausible and UTM tags (migration 068)
Data > Links/redirects (editors and up) makes short links on our
domain. GET /go/<id> counts the click, reports it to Plausible as a
pageview of /go/<id> (the visitor's browser and address, no key
needed), and redirects (302, no-store) with the link's UTM tags added
to the destination. Unknown ids fall through to the not-found page.
The editor can show a fixed lead-in in the URL ID box (idPrefix).
Vite proxies /go in dev. docs/redirects.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 00:37:26 -05:00

2.3 KiB

Links/redirects

Short links on our own domain, made in Admin → Data → Links/redirects (editors and up), eg. nextgenerationofunity.org/go/retreat-signup. Use them in the newsletter, or anywhere else, so each click is counted.

Each link has:

  • URL ID: the part after /go/. Lowercase letters, numbers and hyphens, and it can't be changed once made, since it's already been sent out.
  • Goes to: a web address (https://...) or a page on this site (/retreats). This can be changed at any time, and every copy of the link already sent follows it.
  • Note: what it's for. Only we see it.
  • UTM tags (source, medium, campaign): added to the destination's address, eg. ?utm_source=newsletter&utm_medium=email&utm_campaign=october-2026. A tag the destination already has is left as it is.

What a click does

GET /go/<URL ID> (server/src/routes/redirects.js, migration 068):

  1. Adds one to the link's Clicks and sets Last click (both on the list page). A save in the editor never changes them.
  2. Tells Plausible, as a pageview of /go/<URL ID> with the visitor's browser and address, so it appears in Top Pages (and in the Discord reports) like any page. A redirect never loads the page script, so the server reports it. It uses PLAUSIBLE_URL, the same as the reports (docs/analytics-reports.md), and needs no API key. If Plausible can't be reached, the redirect still works and the problem is logged once.
  3. Sends the visitor on with a 302. It's never cached, so every click reaches the server.

An unknown URL ID shows the site's not-found page.

Reading the numbers

  • Clicks counts every request, including link checkers. Some email security scanners open every link in a message before the reader does, so a newsletter link can show a few clicks straight away. Plausible leaves out known bots, so its count is usually lower and closer to real readers.
  • In Plausible, filter by page /go/ to see every short link, or by a UTM source or campaign to see what those visitors did once they landed on our site.

Setup

Nothing beyond the migration: nginx already sends /go/... to the API through its catch-all page block (nginx-dev, ngu-prod). In development, Vite proxies /go to the API (vite.config.ts).