-
Notifications
You must be signed in to change notification settings - Fork 72
Add analytics tracking for payment method promotions #11161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add analytics tracking for payment method promotions #11161
Conversation
Implements tracking events for the spotlight promotion component per WOOPMNT-5457: Events added: - wcpay_payment_method_promotion_view - When spotlight appears - wcpay_payment_method_promotion_dismiss - When merchant dismisses - wcpay_payment_method_promotion_cta_click - Primary button click - wcpay_payment_method_promotion_secondary_click - Secondary button click - wcpay_payment_method_promotion_link_click - Terms link click All events include: promotion_id, payment_method, variation_id, display_context, and page. Changes: - Add onView callback prop to Spotlight component - Implement tracking in SpotlightPromotion container - Add payment_method field to Promotion type and mock data - Add comprehensive unit tests for all tracking events 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Test the buildOption 1. Jetpack Beta
Option 2. Jurassic Ninja - available for logged-in A12s🚀 Launch a JN site with this branch 🚀 ℹ️ Install this Tampermonkey script to get more options. Build info:
Note: the build is updated when a new commit is pushed to this PR. |
|
Size Change: +1.07 kB (0%) Total Size: 904 kB
ℹ️ View Unchanged
|
vladolaru
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good, @dmallory42. Apart from some minor comments, let's merge it as we have bigger fish to fry :)
Replace `page` (full URL) with `source` parameter that identifies the page context in a human-readable format: - wcpay-overview - wcpay-settings - wc-settings-payments - unknown (fallback) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Include the full URL path (pathname + search) alongside the human-readable source parameter for more detailed analytics. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The primary action is specifically for activation, so use a more descriptive event name. The cta_label is redundant since the action is always activation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
b67d3e8
into
add/payment-method-promotions
Fixes WOOPMNT-5457
Changes proposed in this Pull Request
Implements analytics tracking for payment method promotion UI components. This adds five tracking events that fire when merchants interact with spotlight promotions:
wcpay_payment_method_promotion_view- Promotion displayedwcpay_payment_method_promotion_dismiss- Promotion dismissedwcpay_payment_method_promotion_activate_click- Activate button clickedwcpay_payment_method_promotion_secondary_click- Secondary action clickedwcpay_payment_method_promotion_link_click- Terms link clickedAll events include these properties:
promotion_id- e.g.,klarna-2026-promopayment_method- e.g.,klarnavariation_id- e.g.,klarna-2026-promo__spotlight_primarydisplay_context- e.g.,spotlightsource- Human-readable page identifier:wcpay-overview,wcpay-settings,wc-settings-paymentspath- Full URL path (pathname + search params)Testing instructions
Unit tests:
Manual testing:
t.gifpixel.wp.com/t.giffires with the correct_enparameter:_en=wcadmin_wcpay_payment_method_promotion_view_en=wcadmin_wcpay_payment_method_promotion_activate_click_en=wcadmin_wcpay_payment_method_promotion_secondary_click_en=wcadmin_wcpay_payment_method_promotion_link_click_en=wcadmin_wcpay_payment_method_promotion_dismisspromotion_id=klarna-2026-promopayment_method=klarnavariation_id=klarna-2026-promo__spotlight_primarydisplay_context=spotlightsource=wcpay-overview(orwcpay-settings/wc-settings-paymentsdepending on page)path=/wp-admin/admin.php?page=wc-admin&path=%2Fpayments%2Foverview(URL-encoded path)npm run changelogto add a changelog file, choosepatchto leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.Post merge
🤖 Generated with Claude Code