[RocketCDN One Click Checkout] - Add tracking for RocketCDN upsell banner view and CTA click events#8130
Conversation
- Implemented `trackRocketCDNUpsellBannerViewed` function to track when the upsell banner is viewed using Mixpanel. - Implemented `trackRocketCDNUpsellCTAClicked` function to track when the upsell CTA is clicked using Mixpanel. - Added event listeners for upsell banner view and CTA click to trigger the respective tracking functions.
There was a problem hiding this comment.
Pull request overview
Adds Mixpanel analytics for RocketCDN upsell interactions in the WP Rocket admin UI, so the team can measure upsell banner exposure and CTA engagement.
Changes:
- Track “RocketCDN Upsell Banner Viewed” when the big RocketCDN upsell CTA is revealed.
- Track “RocketCDN Upsell CTA Clicked” when the upsell CTA button is clicked.
- Update the built admin bundle (
wpr-admin.min.js) to include the new tracking logic.
Reviewed changes
Copilot reviewed 1 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/js/global/rocketcdn.js | Adds Mixpanel tracking functions and hooks them to upsell banner reveal + CTA click. |
| assets/js/wpr-admin.min.js | Rebuilt/minified admin bundle reflecting the new RocketCDN tracking logic. |
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
- Updated ESLint environment to include 'browser'. - Modified button click event to track CTA clicks more accurately. - Added a delay before navigation to ensure Mixpanel events are sent. - Refactored Mixpanel tracking functions for better reusability and clarity. - Consolidated tracking logic for upsell banner views and CTA clicks.
# Conflicts: # assets/js/wpr-admin.js # assets/js/wpr-admin.min.js # src/js/global/rocketcdn.js
|
Thanks, @Miraeld, for this PR. While testing, after enabling data analytics, I couldn’t see any events being sent to Mixpanel when a user lands on the CDN tab with the Upsell RocketCDN banner present, nor when clicking the “Get Started” CTA from it. |
- Fix bug where tracking function returned early without calling mixpanel.track() - Add banner view tracking on page load for both small and big banners - Ensure events are sent when user lands on CDN tab - Ensure events are sent when clicking Get Started CTA
|
Hello @hanna-meda ,
|
- Update rocket_mixpanel_data.optin_enabled immediately when user toggles analytics checkbox - Ensures tracking events are only sent when user has given consent - Prevents events from being sent after user disables Data Analytics
|
@hanna-meda My bad, here you go. |
|
@Miraeld, I'm not seeing any RocketCDN upsell banner-related events being sent to Mixpanel now, with the latest changes 🤔 |
|
Confirming that this is now working as expected. The “RocketCDN Upsell CTA Clicked” and “RocketCDN Upsell Banner Viewed” events are sent on page view and CTA click, and they stop being sent when data analytics is turned off. The only remaining thing is to see why the events aren’t sent when using the ZIP from the PR. |
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesFootnotes
|


Description
Fixes #8129
Add tracking for RocketCDN upsell banner view and CTA click events
trackRocketCDNUpsellBannerViewedfunction to track when the upsell banner is viewed using Mixpanel.trackRocketCDNUpsellCTAClickedfunction to track when the upsell CTA is clicked using Mixpanel.Type of change
Detailed scenario
What was tested
Tracking
How to test
Upsell banner view + cta click should trigger tracking
Affected Features & Quality Assurance Scope
Mixpanel
Technical description
Documentation
This pull request adds event tracking for RocketCDN upsell interactions using Mixpanel in the
src/js/global/rocketcdn.jsfile. The main focus is to track when users view the upsell banner and click the upsell call-to-action (CTA), helping improve analytics and user engagement insights.Event Tracking Enhancements:
trackRocketCDNUpsellBannerViewedfunction to track when the RocketCDN upsell banner is displayed, sending relevant context and user identification to Mixpanel.trackRocketCDNUpsellBannerViewedwhen the big CTA is shown, ensuring banner views are tracked at the correct interaction point.trackRocketCDNUpsellCTAClickedfunction to track when the upsell CTA button is clicked, including user and context data in the Mixpanel event.Mandatory Checklist
Code validation
Code style
Unticked items justification
No test for js