You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds @vercel/analytics (<Analytics /> in _app.tsx) and a typed trackVercelAnalyticsEvent() helper in lib/analytics.ts. Event properties stay non-identifying: no addresses, ENS names, tx hashes or error text.
Instruments 11 of the 13 funnel events from the plan: Orchestrators nav click (desktop + mobile drawer), Orchestrators page view, orchestrator detail view, wallet connect (with a coarse surface property), delegation form start, delegation tx submitted/confirmed/failed, Delegating tab view, redelegation started, and unbonding started.
All transaction events go through useHandleTransaction. A "Move Delegated Stake" bond counts as redelegation_started only, so it stays out of the delegation submitted → confirmed/failed conversion.
delegation_form_started fires once per widget mount, on the first clean → dirty transition.
Not implemented: earn_entry_point_clicked and delegation_review_opened, because the UI they depend on doesn't exist yet.
Test plan
pnpm typecheck, pnpm lint, pnpm test pass
In dev (Vercel Analytics debug mode), confirmed each of these fires once: nav click, Orchestrators page view, orchestrator detail view, form start (including after clearing and re-entering an amount), Delegating tab view
Wallet connect and the transaction events (delegate, undelegate, redelegate, and "Move Delegated Stake" → redelegation_started) still need a check with a real wallet
After deploy, check that custom events show up in the Vercel Analytics dashboard
The reason will be displayed to describe this comment to others. Learn more.
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.
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/analytics with <Analytics beforeSend={...} /> and a new lib/analytics.ts helper 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.
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>
The reason will be displayed to describe this comment to others. Learn more.
Copilot review overview
🟡 Changes recommended
The current confirmed/failed analytics emitted from useHandleTransaction appear to be driven by useWriteContract submission state and pre-submission errors rather than on-chain receipt outcomes, which will skew the funnel metrics.
Get a fresh assessment by requesting another Copilot review.
The reason will be displayed to describe this comment to others. Learn more.
Copilot review overview
🟡 Changes recommended
layouts/main.tsx still sends wallet addresses in Google Analytics page paths, which conflicts with the PR/issue’s non-identifying analytics intent and should be redacted similarly.
Get a fresh assessment by requesting another Copilot review.
delegation_transaction_confirmed fired as soon as the wallet returned a
hash, so a delegation that later reverted on chain still counted as
confirmed and the submitted -> confirmed rate always read ~100%. Await the
receipt instead, outside React so the result is still tracked when the
sending component unmounts.
Rejected signatures and failed sends no longer count as failures either,
since neither ever submits a transaction, which keeps failures within
submissions.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Gate delegation_form_started tracking on wallet connection
components/DelegatingWidget/index.tsx:11
delegation_form_started is currently able to fire even when no wallet is connected because the amount input is still editable without useAccountAddress(). That breaks the intended funnel ordering (wallet_connected �0% delegation_form_started) and makes the event harder to interpret; gate the tracking on a connected wallet address.
This issue also appears on line 79 of the same file.
The reason will be displayed to describe this comment to others. Learn more.
Copilot review overview
🟡 Changes recommended
Transaction success/failure analytics classification can be inaccurate due to treating any receipt-wait error as an on-chain failure, which can skew funnel metrics.
Get a fresh assessment by requesting another Copilot review.
The reason will be displayed to describe this comment to others. Learn more.
Agreed on the RPC-error case. A failed receipt lookup doesn't mean the delegation failed, so it shouldn't emit delegation_transaction_failed. Wagmi already rejects reverted receipts; the remaining issue is distinguishing those from lookup errors.
The reason will be displayed to describe this comment to others. Learn more.
Can we gate delegation_form_started on wallet connection and reset it for a new delegation attempt? Currently, typing while disconnected fires the event, but submitting and starting another delegation in the same widget doesn't. The ticket calls for once per attempt after connecting.
The reason will be displayed to describe this comment to others. Learn more.
Can we handle cancelled/replaced transactions in trackTransaction? A wallet cancellation can return a successful replacement receipt and currently gets counted as a confirmed delegation. We should only count confirmation when the delegation itself succeeds.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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