Fix: Update WP Rocket promotional link and UTMs#1023
Fix: Update WP Rocket promotional link and UTMs#1023faisalahammad wants to merge 1 commit intowp-media:developfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Updates Imagify’s WP Rocket promotional destinations to point to the new “Imagify users” landing page and to use the requested UTM tracking values.
Changes:
- Updated
imagify_get_wp_rocket_url()base URL and default UTM parameters. - Updated WP Rocket CTA link generation in the PluginFamily model to use the new landing page and UTMs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
inc/functions/admin.php |
Switches WP Rocket base URL to the new landing page and updates default UTM parameters used by admin banners/views. |
classes/Dependencies/WPMedia/PluginFamily/Model/PluginFamily.php |
Updates the “Our Plugins” WP Rocket CTA URL to target the new landing page with updated UTMs. |
Comments suppressed due to low confidence (1)
inc/functions/admin.php:230
imagify_get_wp_rocket_url()appends the locale segment after the base URL. With the new base includingwp-rocket-for-imagify-users/, non-English URLs become.../wp-rocket-for-imagify-users/fr/instead of the existing pattern used elsewhere in this helper (https://wp-rocket.me/fr/...). This likely breaks localized landing pages; consider keeping the base ashttps://wp-rocket.me/, appending the locale first (when needed), then appendingwp-rocket-for-imagify-users/(and any optional$path).
$wprocket_url = 'https://wp-rocket.me/wp-rocket-for-imagify-users/';
// Current lang.
$lang = imagify_get_current_lang_in( [ 'de', 'es', 'fr', 'it' ] );
if ( 'en' !== $lang ) {
$wprocket_url .= $lang . '/';
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Create unique CTA data for WP Rocket. | ||
| if ( 'wp-rocket/wp-rocket' === $plugin ) { | ||
| $url = 'https://wp-rocket.me/?utm_source=' . $wpr_referrer . '-coupon&utm_medium=plugin&utm_campaign=' . $wpr_referrer; | ||
| $url = 'https://wp-rocket.me/wp-rocket-for-imagify-users/?utm_campaign=' . $wpr_referrer . '-benefits&utm_source=' . $wpr_referrer . '&utm_medium=partners'; |
There was a problem hiding this comment.
The WP Rocket CTA URL is assembled via manual string concatenation with interpolated values. To avoid malformed query strings and ensure proper URL encoding, build this URL with add_query_arg() (or similar) and encode $wpr_referrer before using it in query values.
| $url = 'https://wp-rocket.me/wp-rocket-for-imagify-users/?utm_campaign=' . $wpr_referrer . '-benefits&utm_source=' . $wpr_referrer . '&utm_medium=partners'; | |
| $encoded_wpr_referrer = rawurlencode( $wpr_referrer ); | |
| $url = add_query_arg( | |
| [ | |
| 'utm_campaign' => $encoded_wpr_referrer . '-benefits', | |
| 'utm_source' => $encoded_wpr_referrer, | |
| 'utm_medium' => 'partners', | |
| ], | |
| 'https://wp-rocket.me/wp-rocket-for-imagify-users/' | |
| ); |
remyperona
left a comment
There was a problem hiding this comment.
Please fix the merge conflicts, and follow the suggestion from the review
Replace manual string concatenation with WordPress's add_query_arg() and rawurlencode() to ensure proper URL encoding and avoid malformed query strings as recommended by code review. Addresses: wp-media#1023 (comment)
|
Thank you, @remyperona for the review feedback! I have applied the suggested change in the latest commit ( The WP Rocket CTA URL in All 24 unit tests continue to pass. |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
Changes are ok, but you still have merge conflicts to fix with the main |
5d155f9 to
499345e
Compare
|
Hi @remyperona, thanks for the follow-up! I've rebased the branch onto the latest What happened:
Current state:
The branch should now be conflict-free and ready to merge. |
Summary
Updates WP Rocket promotion links to correctly track Imagify users with the requested UTM parameters.
Fixes #1008
Problem
The WP Rocket promotional banners and Our Plugins page linked to the default WP Rocket URL with outdated UTM campaigns (
imagify-coupon). Users need to be redirected to a targeted landing page (wp-rocket-for-imagify-users/) with updated tracking parameters.Solution
Updated the generated base URL and the UTM parameter array in
imagify_get_wp_rocket_url(). Similarly, updated the dynamic URL assembled for WP Rocket in thePluginFamilycomponent while maintaining existing variable interpolations.Changes
inc/functions/admin.php
Before:
After:
Why this works:
Updating the base URL string directly routes users to the new landing page, and changing the default query array variables preserves existing URL generation logic while strictly satisfying the new UTM tracking requests.
classes/Dependencies/WPMedia/PluginFamily/Model/PluginFamily.php
Before:
After:
Why this works:
Modifying the hardcoded URL respects the dynamic
$wpr_referrervariable logic previously established, allowing tracking parameters to scale gracefully via existing references.Testing
Manual Testing
Test Case 1: WP Rocket URL verification
Tools > Our Pluginsand check the "Get it Now" link.https://wp-rocket.me/wp-rocket-for-imagify-users/?utm_campaign=imagify-benefits&utm_source=imagify&utm_medium=partnersas expected.Automated Tests
$ composer test-unit PHPUnit 9.6.34 by Sebastian Bergmann and contributors. Runtime: PHP 8.5.3 Configuration: Tests/Unit/phpunit.xml.dist ........................ 24 / 24 (100%) OK, but incomplete, skipped, or risky tests! Tests: 24, Assertions: 59, Risky: 5.Build Artifact
For manual verification, I've attached a build of the plugin with these changes:
imagify-fix-issue-1008.zip
Installation:
WordPress Admin > Plugins > Add New > Upload PluginScreenshot