From dd53c8d62b1bfc94b99d9746f8da87d4d1f8d52f Mon Sep 17 00:00:00 2001 From: And Finally Date: Wed, 13 Oct 2021 14:14:49 +0100 Subject: [PATCH] Added UTM params to vendor URL. --- .../admin/views/html-admin-page-addons.php | 33 ++++++++++++++----- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/includes/admin/views/html-admin-page-addons.php b/includes/admin/views/html-admin-page-addons.php index 2c2793b8f83..2f0c11949a7 100644 --- a/includes/admin/views/html-admin-page-addons.php +++ b/includes/admin/views/html-admin-page-addons.php @@ -164,15 +164,30 @@ function wccom_get_star_class( $rating, $index ) { vendor_name ) && ! empty( $addon->vendor_url ) ) : ?>
%2$s', - esc_url_raw( $addon->vendor_url ), - wp_kses_post( $addon->vendor_name ) - ) - ); + $parsed_vendor_url = parse_url( $addon->vendor_url ); + if ( $parsed_vendor_url['path'] == null ) { + $addon->vendor_url .= '/'; + } + $separator = ( $parsed_vendor_url['query'] == null ) ? '?' : '&'; + $query = http_build_query( + array( + 'utm_source' => 'extensionsscreen', + 'utm_medium' => 'product', + 'utm_campaign' => 'wcaddons', + 'utm_content' => 'devpartner', + ) + ); + $addon->vendor_url .= $separator . $query; + + printf( + /* translators: %s vendor link */ + esc_html__( 'Developed by %s', 'woocommerce' ), + sprintf( + '%2$s', + esc_url_raw( $addon->vendor_url ), + wp_kses_post( $addon->vendor_name ) + ) + ); ?>