Skip to content

chore: track reward task click and completion events#913

Merged
lefarcen merged 1 commit intomainfrom
feat/rewards-task-tracking
Apr 8, 2026
Merged

chore: track reward task click and completion events#913
lefarcen merged 1 commit intomainfrom
feat/rewards-task-tracking

Conversation

@lefarcen
Copy link
Copy Markdown
Collaborator

@lefarcen lefarcen commented Apr 8, 2026

What

Add two PostHog events to the rewards page so PM can measure click frequency and click→completion conversion for each social/open-source reward task:

  • workspace_task_click — fires when a user clicks a reward task
  • workspace_task_done — fires when a user successfully claims a task in the confirm modal

Why

PM needs the click → completion funnel per task to decide which reward tasks to expand or retire.

Event `type` values

PM-defined naming:

Internal task id `type` value click done
`github_star` `star_us`
`x_share` `X`
`reddit` `Reddit`
`lingying` `linkedin`
`facebook` `Facebook`
`whatsapp` `Whatsapp`
`mobile_share` `mobile`
`daily_checkin`

Implementation notes

  • Two `Partial<Record<RewardTaskId, string>>` tables hold the click/done type mappings
  • `mobile_share` is intentionally excluded from click tracking — its click only opens the QR modal; the meaningful signal is the screenshot upload, captured via `done`
  • `daily_checkin` goes through a separate inline claim path that doesn't reach the confirm modal, so it's automatically excluded from both events
  • The done event only fires when `!result.alreadyClaimed`, so re-claiming an already-claimed task doesn't double-count
  • Using `Partial<Record<RewardTaskId, string>>` instead of an open string dict means adding a new task id later won't silently emit an unknown `type` — you have to explicitly opt it in

Affected areas

  • Desktop app (Electron shell)
  • Controller (backend / API)
  • Web dashboard (React UI)
  • OpenClaw runtime
  • Skills
  • Shared schemas / packages
  • Build / CI / Tooling

Checklist

  • `pnpm typecheck` passes
  • `pnpm lint` passes
  • No credentials or tokens in code or logs
  • No `any` types introduced

Add posthog tracking for the rewards page so PM can measure how often
each reward task is clicked vs actually completed:

- workspace_task_click fires when the user clicks a non-daily reward
  task (mobile_share excluded — its click only opens the QR modal,
  the meaningful signal is the screenshot upload tracked via done).
- workspace_task_done fires inside the confirm modal's success path,
  only on a fresh claim (not alreadyClaimed), and includes mobile_share.

Type values mirror the PM-defined names: star_us, X, Reddit, linkedin,
Facebook, Whatsapp, mobile. daily_checkin is intentionally untracked
per spec.

Mapping is held in two Partial<Record<RewardTaskId, string>> tables so
adding a new task id doesn't silently start emitting an unknown type.
@sentry
Copy link
Copy Markdown

sentry Bot commented Apr 8, 2026

Codecov Report

❌ Patch coverage is 59.09091% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
apps/web/src/pages/rewards.tsx 59.09% 9 Missing ⚠️

📢 Thoughts on this report? Let us know!

@lefarcen lefarcen changed the title feat(web): 奖励任务点击与完成埋点 feat(web): track reward task click and completion events Apr 8, 2026
@mrcfps mrcfps changed the title feat(web): track reward task click and completion events chore: track reward task click and completion events Apr 8, 2026
@lefarcen lefarcen merged commit d0da4b1 into main Apr 8, 2026
14 checks passed
@lefarcen lefarcen mentioned this pull request Apr 8, 2026
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.

2 participants