Skip to content

[RocketCDN One Click Checkout] - Add tracking for RocketCDN upsell banner view and CTA click events#8130

Merged
wordpressfan merged 9 commits into
developfrom
enhancement/add-rocketcdn-tracking
Mar 17, 2026
Merged

[RocketCDN One Click Checkout] - Add tracking for RocketCDN upsell banner view and CTA click events#8130
wordpressfan merged 9 commits into
developfrom
enhancement/add-rocketcdn-tracking

Conversation

@Miraeld
Copy link
Copy Markdown
Contributor

@Miraeld Miraeld commented Mar 6, 2026

Description

Fixes #8129
Add tracking for RocketCDN upsell banner view and CTA click events

  • 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.

Type of change

  • Enhancement (non-breaking change which improves an existing functionality).

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.js file. 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:

  • Added a trackRocketCDNUpsellBannerViewed function to track when the RocketCDN upsell banner is displayed, sending relevant context and user identification to Mixpanel.
  • Integrated a call to trackRocketCDNUpsellBannerViewed when the big CTA is shown, ensuring banner views are tracked at the correct interaction point.
  • Added a trackRocketCDNUpsellCTAClicked function to track when the upsell CTA button is clicked, including user and context data in the Mixpanel event.
  • Registered a click event listener on the upsell CTA button to trigger Mixpanel tracking for CTA clicks.

Mandatory Checklist

Code validation

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I protected entry points against unexpected inputs.
  • I did not introduce unnecessary complexity.
  • Output messages (errors, notices, logs) are explicit enough for users to understand the issue and are actionnable.

Unticked items justification

No test for js

- 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.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/js/global/rocketcdn.js Outdated
Comment thread src/js/global/rocketcdn.js Outdated
Comment thread src/js/global/rocketcdn.js Outdated
Comment thread src/js/global/rocketcdn.js Outdated
@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented Mar 6, 2026

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.00% (target: -0.10%) (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (2e0dc67) 42555 19394 45.57%
Head commit (04a6094) 42555 (+0) 19394 (+0) 45.57% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#8130) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

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.
Comment thread src/js/global/rocketcdn.js
Comment thread src/js/global/rocketcdn.js
# Conflicts:
#	assets/js/wpr-admin.js
#	assets/js/wpr-admin.min.js
#	src/js/global/rocketcdn.js
@hanna-meda
Copy link
Copy Markdown
Contributor

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.
Could you have another look at this?

Miraeld added 2 commits March 9, 2026 11:22
- 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
@Miraeld
Copy link
Copy Markdown
Contributor Author

Miraeld commented Mar 9, 2026

Hello @hanna-meda ,
Can you please re-check with latest commit,
I'm getting this debug (added just for the manual test before asking you to check, so you won't have these debug lines). It works for me :)

Screenshot 2026-03-09 at 11 20 06

@hanna-meda
Copy link
Copy Markdown
Contributor

@Miraeld,

I can see that events are now being sent to Mixpanel, but it appears they are sent regardless of the user’s consent for Data Analytics.

As shown in the screenshot below, both “RocketCDN Upsell CTA Clicked” and “RocketCDN Upsell Banner Viewed” events are still being sent even after the user has turned off Data Analytics.
Screenshot 2026-03-09 at 13 05 48

- 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
@Miraeld
Copy link
Copy Markdown
Contributor Author

Miraeld commented Mar 9, 2026

@hanna-meda My bad, here you go.

@hanna-meda
Copy link
Copy Markdown
Contributor

hanna-meda commented Mar 11, 2026

@Miraeld, I'm not seeing any RocketCDN upsell banner-related events being sent to Mixpanel now, with the latest changes 🤔
[Later edit] I can see the events, but only when I check out the branch, not when I use the zip from this PR.

@hanna-meda
Copy link
Copy Markdown
Contributor

hanna-meda commented Mar 11, 2026

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.

@codacy-production
Copy link
Copy Markdown

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for cab46c31 (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (cab46c3) Report Missing Report Missing Report Missing
Head commit (17e9435) 42557 19395 45.57%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#8130) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

@wordpressfan wordpressfan added this pull request to the merge queue Mar 17, 2026
Merged via the queue into develop with commit 9ba327d Mar 17, 2026
15 checks passed
@wordpressfan wordpressfan deleted the enhancement/add-rocketcdn-tracking branch March 17, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

As a product manager, I need to have visibility on banners/actions performance

5 participants