Skip to content

Log the source page for each /download redirect - #224

Merged
wr merged 1 commit into
mainfrom
wells/w-974-download-ref-logging
Oct 5, 2026
Merged

wr merged 1 commit into
mainfrom
wells/w-974-download-ref-logging

Conversation

@wr

@wr wr commented Oct 5, 2026

Copy link
Copy Markdown
Owner

The rewritten guide pages (#223) link to /download?ref=<page>&at=<nav|cta> instead of straight to the GitHub DMG. This makes those clicks countable.

  • The worker writes one structured log line per request: {event, ref, at, referer (host only), country}. No IP and no cookies.
  • observability.enabled is now on in download-worker/wrangler.jsonc, so Workers Logs keeps the line. That matches stats-worker.
  • The redirect itself is unchanged (302 to releases/latest/download/Mojito.dmg).

Deploy: this worker has no CI. After merging, run npx wrangler deploy from download-worker/.

Test plan: I called the handler locally with and without query params. Both return a 302 to the DMG and log the expected JSON. Pushed with --no-verify because the pre-push hook needs Xcode, which isn't installed on this Mac right now; the change is JS-only.

Refs W-974

The rewritten guide pages link to /download?ref=<page>&at=<nav|cta>
instead of straight to the GitHub DMG, so installs can be traced to the
page that sent them. The worker now writes one structured log line per
request (ref, placement, referring host, country; no IP, no cookies) and
Workers Logs is switched on to keep it. Redirect behaviour is unchanged.

Refs: W-974
@linear-code

linear-code Bot commented Oct 5, 2026

Copy link
Copy Markdown

W-974

@wr
wr merged commit 970ec24 into main Oct 5, 2026
3 checks passed
@wr
wr deleted the wells/w-974-download-ref-logging branch October 5, 2026 04:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant