open-design/apps/landing-page/functions
ashleytheash dbdf3b9637
feat(landing): add /share-out redirect to track X share button clicks (#2969)
* feat(landing): add /share-out redirect for X share button click tracking

Adds a Cloudflare Pages Function at /share-out/:eventId that records each
click of the "Share on X" button surfaced in the contributor card comments
on GitHub, then 302-redirects to the original twitter.com / x.com intent
URL (passed via ?to=, host-allowlisted).

Together with the existing /share/:eventId function this gives us both
sides of the X funnel without an X API key:

  - /share-out/:eventId  -> GitHub user clicked the X button   (funnel step 1)
  - /share/:eventId      -> someone on X clicked the posted tweet (funnel step 2)

Per-event KV storage is optional (SHARE_OUT_CLICK_EVENTS). When no KV is
bound the function falls back to console.log; aggregate counts are visible
in Cloudflare Pages analytics with no extra setup.

Co-authored-by: Cursor <cursoragent@cursor.com>

* chore: retrigger CI

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: ashley li <ashleyli@ashleydeMacBook-Air-2.local>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-26 15:13:59 +08:00
..
share fix(landing): add contributor share redirect tracking (#2056) 2026-05-18 19:20:56 +08:00
share-out feat(landing): add /share-out redirect to track X share button clicks (#2969) 2026-05-26 15:13:59 +08:00