feat: implement Homepage Perps pills empty state AB test logic and analytics#30246
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0c80a46. Configure here.
…itional properties
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection: SmokePerps is required because it validates the Perps trading flows (including Add Funds deposit and balance updates) and ensures that UI changes in Perps surfaces do not break trading entry points or state handling. Per tag requirements, selecting SmokePerps also requires:
No changes were made to controllers, Engine, network abstractions, identity/sync, swaps, stake, money, browser, or onboarding flows, so other tags are not necessary. Risk is medium: changes affect user-facing UI components and analytics enrichment logic tied to A/B tests, which can influence rendering and conditional display of Perps content, but do not modify core transaction, controller, or network logic. Performance Test Selection: |
|




Description
Base branch:
TMCU-725(homepage Perps empty-state / pills work already on that branch).This PR adds A/B analytics and attribution for the homepage Perps pills empty-state experiment—reusing existing events (
Home Viewed,Perp UI Interaction, existing perps transaction pipeline)—no new event names.abTestConfig:HOMEPAGE_PERPS_PILLS_AB_EXPOSED_ANALYTICS_PROPERTY, sharedHOMEPAGE_PERPS_PILLS_EMPTY_AB_TEST_EXPOSURE_OPTIONS,getHomepagePerpsPillsEmptyTransactionActiveAbTests(), and twoABTestAnalyticsMappingentries for the same LD key (homeTMCU725AbtestHomepagePerpsPillsEmptyState): one for Home Viewed, one for Perp UI Interaction, each gated withinjectWhenPropertiesMatchsoactive_ab_testsis only injected on the empty homepage perps surface (avoids pullingHomeSectionNamesintoabTestConfigto prevent circular imports with analytics).enrichWithABTests/ types / registry: optionalinjectWhenPropertiesMatch; registry registers both mappings.mergeActiveAbTestAssignmentListsinactiveABTestAssignments.ts: merge + de-dupe bykeyfor transaction payloads.useHomeViewedEvent: optionaladditionalPropertiesmerged intoHOME_VIEWED(used to set the exposure gate flag when appropriate).PerpsSection: AfterhasItemsis known, wiresuseHomepageTrendingTransactionActiveAbTests+useHomepagePerpsPillsEmptyTransactionActiveAbTests(!hasItems)intousePerpsNavigationHandlersvia mergedtransactionActiveAbTestson market details navigation from empty carousel tiles; empty carousel useshandleTrendingMarketPressto emit Perp UI Interaction withWALLET_HOME+homepage_perps_pills_ab_exposed: true;HOME_VIEWEDgetsadditionalPropertieswhensection_name === perpsand!hasItems. Trending-only mode: dropsisDedicatedTrendingSectionand passes only trending tx tests (merge still works).HomepagePerpsMoversSection: Same exposure property on pill tap +useHomeViewedEventadditionalPropertiesfor defaultperpssection; merges trending + pills tx tests and passes them toPerpsPillItem.HomepagePerpsHomeSlot:useABTestnow usesHOMEPAGE_PERPS_PILLS_EMPTY_AB_TEST_EXPOSURE_OPTIONSfrom config (DRY).PerpsPillItem: optionaltransactionActiveAbTestsforwarded into market-details routeparams.Changelog
CHANGELOG entry: null
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Medium Risk
Moderate risk because it changes analytics enrichment rules and propagates A/B assignment metadata through perps navigation, which could affect event payloads and downstream attribution if gated incorrectly.
Overview
Adds gated A/B exposure + attribution for the homepage Perps empty-state pills experiment, including a new
homepage_perps_pills_ab_exposedproperty used to conditionally injectactive_ab_testsonHome ViewedandPerp UI Interactionevents.Updates homepage Perps surfaces (
PerpsSection,HomepagePerpsMoversSection,HomepagePerpsHomeSlot) to tag the relevant events, merge/de-dupe multipletransactionActiveAbTestssources, and pass those assignments through to market-details navigation (including new support inPerpsPillItem).Extends the analytics enrichment framework with
injectWhenPropertiesMatchgating and adds coverage/tests for the new gating behavior and perps empty-surface assignment hook.Reviewed by Cursor Bugbot for commit b8efec8. Bugbot is set up for automated code reviews on this repo. Configure here.