Conversation
|
@Jipperism is attempting to deploy a commit to the Livepeer Foundation Team on Vercel. A member of the Team first needs to authorize it. |
51c5db2 to
b6b8be9
Compare
Adds custom events for the delegation funnel (nav click, page views, wallet connect, form start, transaction submit/confirm/fail) per the instrumentation plan in livepeer#722, so delegator UX changes can be measured against a baseline instead of guessed at. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
b6b8be9 to
cb374a4
Compare
|
@ECWireless ready for review |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
There are a couple of confirmed instrumentation correctness/data-quality gaps (notably route hydration causing double-fires and missing surface property on wallet_connected despite the PR description) that should be fixed before approval.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 3
Open (4)
What changed in this PR
Adds Vercel Web Analytics to instrument the Explorer delegation funnel, including a typed analytics helper and event emission from key UI surfaces (nav, orchestrator pages, wallet connect, form start, and transaction lifecycle).
Changes:
- Added
@vercel/analyticswith<Analytics beforeSend={...} />and a newlib/analytics.tshelper to centralize event tracking/redaction. - Instrumented funnel events across Orchestrators pages, Account tabs, wallet connect, delegation form start, and transaction stages via
useHandleTransaction. - Extended transaction args to flag “Move Delegated Stake” (transfer-stake) so it maps to redelegation events.
| File | Description |
|---|---|
package.json |
Adds @vercel/analytics dependency. |
pnpm-lock.yaml |
Locks @vercel/analytics and related dependency updates. |
pages/_app.tsx |
Mounts Vercel <Analytics /> and applies URL redaction via beforeSend. |
lib/analytics.ts |
Introduces typed funnel event names, tracking helpers, URL redaction, and transaction→event mapping. |
layouts/main.tsx |
Instruments wallet connect and Orchestrators nav click (desktop + drawer item). |
pages/orchestrators.tsx |
Tracks Orchestrators index page view. |
pages/accounts/[account]/orchestrating.tsx |
Tracks orchestrator detail view once per account per session. |
pages/accounts/[account]/delegating.tsx |
Tracks “Delegating” tab view once for the connected user’s account. |
components/Drawer/index.tsx |
Wires drawer item onClick for nav click instrumentation. |
components/DelegatingWidget/index.tsx |
Tracks delegation form start on first clean→dirty transition per mount. |
components/DelegatingWidget/Delegate.tsx |
Passes isTransferStake into tx args for redelegation classification. |
hooks/useExplorerStore.tsx |
Adds isTransferStake?: boolean to transaction input data. |
hooks/useHandleTransaction.tsx |
Routes submitted/confirmed/failed stages into analytics transaction tracking. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| onConnect: ({ isReconnected }) => { | ||
| // Outside of migration and governance, connecting a wallet is taken as | ||
| // delegation intent. Reconnects restore a previous session, so they | ||
| // don't count. | ||
| const isNonDelegationPage = NON_DELEGATION_PATHS.some((path) => | ||
| asPath.startsWith(path) | ||
| ); | ||
| if (!isReconnected && !isNonDelegationPage) { | ||
| trackVercelAnalyticsEvent("wallet_connected"); | ||
| } | ||
| }, | ||
| }); |
| const { query } = useRouter(); | ||
| const viewedAccount = String(query.account); | ||
|
|
||
| useEffect(() => { | ||
| if (!hadError) { | ||
| trackVercelAnalyticsEventOnce( | ||
| "orchestrator_detail_viewed", | ||
| viewedAccount | ||
| ); | ||
| } | ||
| }, [hadError, viewedAccount]); |
| useEffect(() => { | ||
| trackVercelAnalyticsEvent("orchestrators_page_viewed"); | ||
| }, []); |
| type TransactionEvents = Partial< | ||
| Record<TransactionStage, DelegationFunnelEvent> | ||
| >; | ||
|
|
||
| const REDELEGATION_EVENTS: TransactionEvents = { | ||
| submitted: "redelegation_started", | ||
| }; | ||
|
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|


Closes #722
Summary
@vercel/analytics(<Analytics />in_app.tsx) and a typedtrackVercelAnalyticsEvent()helper inlib/analytics.ts. Event properties stay non-identifying: no addresses, ENS names, tx hashes or error text.surfaceproperty), delegation form start, delegation tx submitted/confirmed/failed, Delegating tab view, redelegation started, and unbonding started.useHandleTransaction. A "Move Delegated Stake"bondcounts asredelegation_startedonly, so it stays out of the delegation submitted → confirmed/failed conversion.delegation_form_startedfires once per widget mount, on the first clean → dirty transition.earn_entry_point_clickedanddelegation_review_opened, because the UI they depend on doesn't exist yet.Test plan
pnpm typecheck,pnpm lint,pnpm testpassredelegation_started) still need a check with a real wallet🤖 Generated with Claude Code