fix: add mixpanel tracking for yield.xyz provider (#12013)#12086
fix: add mixpanel tracking for yield.xyz provider (#12013)#12086gomesalexandre merged 5 commits intodevelopfrom
Conversation
📝 WalkthroughWalkthroughAdds Mixpanel yield tracking: six new MixPanelEvent members, a TrackYieldEventProps type and trackYieldEvent helper, and integrates tracking calls into useYieldTransactionFlow with a new assetSymbol parameter to emit confirm and success events at key flow points. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🧪 QA ReportCI Status: ❌ FAILINGFailed step: Lint (Static checks) Files Changed
Action RequiredOnce CI PassesTesting checklist:
|
QA Report ✅Test Environment
Feature DescriptionIssue #12013: Add Mixpanel tracking events for the yield.xyz provider to ensure proper analytics coverage for yield deposits, withdrawals, and claims. Code Review ✅1. New MixPanelEvents in
2. New export const trackYieldEvent = (event: MixPanelEvent, properties: TrackYieldEventProps) => {
// Tracks yield events with provider, yieldType, yieldId, asset, network, amount, action
}3. Integration in
Testing LimitationsCannot verify Mixpanel events without access to the Mixpanel dashboard. Code implementation follows existing patterns in the codebase. Verdict✅ Code implementation is correct - Follows existing Mixpanel tracking patterns and includes comprehensive event data for yield analytics. Automated QA by OpenClaw |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/lib/mixpanel/helpers.ts`:
- Around line 90-104: trackYieldEvent currently calls getMixPanel() and
mixpanel.track() without protection, so any thrown error bubbles up; wrap the
body of trackYieldEvent (calls to getMixPanel() and mixpanel.track(event,
eventData)) in a try/catch, swallow any exceptions so they don't affect
transaction UX, and log the error inside the catch (use the project's logger if
available, otherwise console.error) with context (e.g., "trackYieldEvent failed"
and the error) while returning early on failure.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
src/lib/mixpanel/helpers.tssrc/lib/mixpanel/types.tssrc/pages/Yields/hooks/useYieldTransactionFlow.ts
🤖 QABot Report (2026-03-03)Testing completed. See dashboard for full results. 📊 Dashboard: |
gomesalexandre
left a comment
There was a problem hiding this comment.
In qabot we trust
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/pages/Yields/hooks/useYieldTransactionFlow.ts`:
- Around line 940-958: The current success analytics fire when
transactions.length === 0 which can produce false positives; update the guard in
useYieldTransactionFlow so that you only emit the success mixpanel event (via
trackYieldEvent and successEvent) when the action's status is actually
YieldActionStatus.Success (in addition to transactions.length === 0) — locate
the block that references transactions, action, YieldActionStatus, yieldItem and
trackYieldEvent and add an explicit status check before computing successEvent
and calling trackYieldEvent.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8f313f28-63f5-49dd-a7b7-f7423581e631
📒 Files selected for processing (1)
src/pages/Yields/hooks/useYieldTransactionFlow.ts
Description
This PR adds Mixpanel tracking events for the yield.xyz provider to ensure proper analytics coverage for yield deposits, withdrawals, and claims.
Changes
Added new MixPanelEvents in
src/lib/mixpanel/types.ts:YieldEnterConfirm- Tracked when a yield deposit is confirmedYieldEnterSuccess- Tracked when a yield deposit completes successfullyYieldExitConfirm- Tracked when a yield withdrawal is confirmedYieldExitSuccess- Tracked when a yield withdrawal completes successfullyYieldClaimConfirm- Tracked when a yield claim is confirmedYieldClaimSuccess- Tracked when a yield claim completes successfullyAdded
trackYieldEventhelper insrc/lib/mixpanel/helpers.ts:Integrated tracking in
useYieldTransactionFlowinsrc/pages/Yields/hooks/useYieldTransactionFlow.ts:Event Data
Each yield event includes:
provider: The yield provider ID (e.g., 'yield-xyz', 'lido', etc.)yieldType: The yield mechanics type (e.g., 'staking', 'lending', 'vault')yieldId: The unique yield IDasset: The asset symbolnetwork: The yield networkamountCryptoPrecision: The amount in crypto precisionaction: The action type ('enter', 'exit', or 'manage')Closes #12013
Summary by CodeRabbit
QA Report ✅
Tested: 2026-03-03
Status: PASSED (Code Review + CI)
QABot Report: https://qabot-kappa.vercel.app/runs/56dc244a-4989-42b5-ba9d-a15e09bf5bb0