Skip to content

Commit f94fd6d

Browse files
Implement wp-module-link-tracker features across different URLs
1 parent a11241d commit f94fd6d

File tree

8 files changed

+18
-12
lines changed

8 files changed

+18
-12
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('lodash', 'react', 'react-jsx-runtime', 'wp-api-fetch', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => '4b455cd2f16b1fc7ec6f');
1+
<?php return array('dependencies' => array('lodash', 'react', 'react-jsx-runtime', 'wp-api-fetch', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => '2cd71d34c77ef5bc3e3c');

build/performance/performance.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

includes/HealthChecks/PersistentObjectCacheHealthCheck.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace NewfoldLabs\WP\Module\Performance\HealthChecks;
44

5+
use function NewfoldLabs\WP\Module\LinkTracker\Functions\build_link as buildLink;
56
/**
67
* Health check for persistent object cache.
78
*/
@@ -17,7 +18,7 @@ public function __construct() {
1718
$this->description = esc_html__( 'Object caching saves results from frequent database queries, reducing load times by avoiding repetitive query processing. Object caching is available in all tiers of Bluehost Cloud.', 'wp-module-performance' );
1819
$this->actions = sprintf(
1920
'<a href="%1$s" target="_blank" rel="noopener">%2$s</a><span class="screen-reader-text"> (%3$s)</span><span aria-hidden="true" class="dashicons dashicons-external"></span>',
20-
'https://www.bluehost.com/help/article/object-caching',
21+
buildlink('https://www.bluehost.com/help/article/object-caching' ),
2122
esc_html__( 'Learn more about object caching', 'wp-module-performance' ),
2223
__( 'opens in a new tab', 'wp-module-performance' )
2324
);

includes/Images/ImageLimitBanner.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
namespace NewfoldLabs\WP\Module\Performance\Images;
4+
use function NewfoldLabs\WP\Module\LinkTracker\Functions\build_link as buildLink;
45

56
/**
67
* Displays admin notices for rate limits and bans in the WP Admin area.
@@ -64,7 +65,7 @@ private function display_rate_limit_banner( $rate_limit_time ) {
6465
* Displays the permanent ban banner.
6566
*/
6667
private function display_ban_banner() {
67-
$support_link = admin_url( "admin.php?page={$this->brand}#/help" );
68+
$support_link = buildLink( admin_url( "admin.php?page={$this->brand}#/help" ) );
6869

6970
echo '<div class="notice notice-error">';
7071
echo '<p>';

includes/JetpackBoost/JetpackBoost.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
use NewfoldLabs\WP\Module\Installer\Services\PluginInstaller;
88
use Automattic\Jetpack\My_Jetpack\Products\Boost;
9+
use function NewfoldLabs\WP\Module\LinkTracker\Functions\build_link as buildLink;
10+
911

1012
/**
1113
* Handles link prefetch functionality.
@@ -86,7 +88,7 @@ public function is_jetpackpremium_active() {
8688
*/
8789
public function prefetch_jetpack_boost() {
8890
if ( is_plugin_active( 'jetpack-boost/jetpack-boost.php' ) ) {
89-
$admin_url = admin_url( 'admin.php?page=jetpack-boost' );
91+
$admin_url = buildLink( admin_url( 'admin.php?page=jetpack-boost' ) );
9092
echo '<link rel="prefetch" href="' . esc_url( $admin_url ) . '">' . "\n";
9193
}
9294
}

includes/Performance.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use NewfoldLabs\WP\Module\Performance\Fonts\FontManager;
1515
use NewfoldLabs\WP\Module\Performance\Skip404\Skip404;
1616
use NewfoldLabs\WP\Module\Performance\JetpackBoost\JetpackBoost;
17+
use function NewfoldLabs\WP\Module\LinkTracker\Functions\build_link as buildLink;
1718

1819
use function NewfoldLabs\WP\Module\Performance\get_cache_level;
1920

@@ -241,7 +242,7 @@ public function admin_bar_menu( \WP_Admin_Bar $wp_admin_bar ) {
241242
'id' => 'nfd_purge_menu-purge_all',
242243
'title' => __( 'Purge All', 'wp-module-performance' ),
243244
'parent' => 'nfd_purge_menu',
244-
'href' => add_query_arg( array( self::PURGE_ALL => true ) ),
245+
'href' => buildLink( add_query_arg( array( self::PURGE_ALL => true ) ) ),
245246
)
246247
);
247248

@@ -251,7 +252,7 @@ public function admin_bar_menu( \WP_Admin_Bar $wp_admin_bar ) {
251252
'id' => 'nfd_purge_menu-purge_single',
252253
'title' => __( 'Purge This Page', 'wp-module-performance' ),
253254
'parent' => 'nfd_purge_menu',
254-
'href' => add_query_arg( array( self::PURGE_URL => true ) ),
255+
'href' => buildLink( add_query_arg( array( self::PURGE_URL => true ) ) ),
255256
)
256257
);
257258
}
@@ -262,7 +263,7 @@ public function admin_bar_menu( \WP_Admin_Bar $wp_admin_bar ) {
262263
'id' => 'nfd_purge_menu-cache_settings',
263264
'title' => __( 'Cache Settings', 'wp-module-performance' ),
264265
'parent' => 'nfd_purge_menu',
265-
'href' => admin_url( 'tools.php?page=' . self::PAGE_SLUG ),
266+
'href' => buildLink( admin_url( 'tools.php?page=' . self::PAGE_SLUG ) ),
266267
)
267268
);
268269
}

src/sections/ImageOptimization/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ const ImageOptimization = () => {
237237

238238
const mediaLibraryLink = () => {
239239
const basePath = window.location.pathname.split( '/wp-admin' )[ 0 ];
240-
return `${ window.location.origin }${ basePath }/wp-admin/upload.php?autoSelectBulk`;
240+
const mediaLink = `${ window.location.origin }${ basePath }/wp-admin/upload.php?autoSelectBulk`;
241+
return window.NewfoldRuntime.linkTracker.addUtmParams( mediaLink );
241242
};
242243

243244
const polishEnabled = isCapabilityEnabled( 'hasCloudflarePolish' );

src/sections/JetpackBoost/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ const JetpackBoost = () => {
148148
await new Promise( ( resolve ) => setTimeout( resolve, 1000 ) );
149149
const adminUrl = `${ siteUrl }/wp-admin/admin.php?page=jetpack-boost`;
150150
iframe = document.createElement( 'iframe' );
151-
iframe.src = adminUrl;
151+
iframe.src = window.NewfoldRuntime.linkTracker.addUtmParams( adminUrl );
152152
document.body.appendChild( iframe );
153153
iframe.style.height = '0';
154154
iframe.onload = async function () {
@@ -340,7 +340,7 @@ const JetpackBoost = () => {
340340
{ isModuleEnabled && ! isPremiumActive ? (
341341
<FeatureUpsell
342342
cardText={ upgradeModule }
343-
cardLink={ `${ siteUrl }/wp-admin/admin.php?page=my-jetpack#/add-boost` }
343+
cardLink={ window.NewfoldRuntime.linkTracker.addUtmParams( `${ siteUrl }/wp-admin/admin.php?page=my-jetpack#/add-boost` )}
344344
>
345345
{ cssPremiumField }
346346
</FeatureUpsell>

0 commit comments

Comments
 (0)