Skip to content

Commit 9222687

Browse files
authored
Merge pull request #354 from athemes/improvement/rt/utm-wrapper
Implement UTM wrapper function for upsell links
2 parents 9231d62 + c053add commit 9222687

18 files changed

+132
-53
lines changed

assets/js/src/customizer-scripts.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,10 @@ jQuery(document).ready(function ($) {
7373
jQuery(document).ready(function ($) {
7474
$( '.control-section-botiga-section-upsell, .control-panel-botiga-panel-upsell' ).on( 'click', function() {
7575
const feature = $( this ).data( 'feature' );
76-
77-
window.open( 'https://athemes.com/botiga-upgrade?utm_source=theme_customizer&utm_content='+ feature +'&utm_medium=botiga_customizer&utm_campaign=Botiga', '_blank' );
76+
const decodedUpgradeLink = decodeURIComponent( botigaadm.customizer_upgrade_link_with_utm_content_markup );
77+
const url = decodedUpgradeLink.replace( '{{utm_content}}', feature );
78+
79+
window.open( url, '_blank' );
7880
} );
7981
});
8082

functions.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ function botiga_admin_scripts() {
396396
'confirmMessage' => __( 'Are you sure you want to dismiss this notice?', 'botiga' ),
397397
'errorMessage' => __( 'It was not possible complete the request, please reload the page and try again.', 'botiga' ),
398398
),
399+
'customizer_upgrade_link_with_utm_content_markup' => botiga_upgrade_link( 'theme_customizer', '{{utm_content}}' ),
399400
) );
400401
}
401402
add_action( 'admin_enqueue_scripts', 'botiga_admin_scripts' );

inc/customizer/controls/class_botiga_section_upsell_message.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ class Botiga_Section_Upsell_Message extends WP_Customize_Section {
2020
public $display_thumb = false;
2121
public $features_list = array();
2222
public $button_text = '';
23-
public $button_link = 'https://athemes.com/botiga-upgrade?utm_source=theme_customizer_deep&utm_medium=button&utm_campaign=Botiga';
23+
public $button_link = '';
2424

2525
public function __construct( $wp_customize, $id, $args = array(), $options = array() ) {
2626
parent::__construct( $wp_customize, $id, $args );
2727

28+
$this->button_link = botiga_upgrade_link( 'theme_customizer_deep' );
2829
$this->button_text = esc_html__( 'Upgrade Now', 'botiga' );
2930
}
3031

inc/customizer/controls/class_botiga_upsell_message.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,18 @@ class Botiga_Upsell_Message extends WP_Customize_Control {
2323
public $features_list = array();
2424
public $features_list_last_item_text = array();
2525
public $button_text = '';
26-
public $button_link = 'https://athemes.com/botiga-upgrade?utm_source=theme_customizer_deep&utm_medium=button&utm_campaign=Botiga';
27-
public $all_features_link = 'https://athemes.com/theme/botiga/?utm_source=theme_customizer_deep&utm_medium=button&utm_campaign=Botiga#see-all-features';
26+
public $button_link = '';
27+
public $all_features_link = '';
2828

2929
/**
3030
* Constructor
3131
*/
3232
public function __construct( $manager, $id, $args = array(), $options = array() ) {
3333
parent::__construct( $manager, $id, $args );
3434

35+
$this->button_link = botiga_upgrade_link( 'theme_customizer_deep' );
36+
$this->all_features_link = botiga_upgrade_link( 'theme_customizer_deep', '', '#see-all-features' );
37+
3538
$this->button_text = esc_html__( 'Upgrade to Botiga Pro', 'botiga' );
3639

3740
if ( empty( $this->sub_title ) ) {

inc/customizer/options/upsell.php

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
esc_html__( 'Polylang/WPML language switcher', 'botiga' ),
3333
),
3434
'section' => 'botiga_section_main_header',
35-
'button_link' => 'https://athemes.com/botiga-upgrade?utm_source=theme_customizer_deep&utm_content=main_header&utm_medium=button&utm_campaign=Botiga',
36-
'all_features_link' => 'https://athemes.com/theme/botiga/?utm_source=theme_customizer_deep&utm_content=main_header_all_features&utm_medium=button&utm_campaign=Botiga#see-all-features',
35+
'button_link' => botiga_upgrade_link( 'theme_customizer_deep', 'main_header' ),
36+
'all_features_link' => botiga_upgrade_link( 'theme_customizer_deep', 'Main Header All Features Link', '#see-all-features' ),
3737
'priority' => 999,
3838
)
3939
)
@@ -61,8 +61,8 @@
6161
esc_html__( 'Page level options to control the image', 'botiga' ),
6262
),
6363
'section' => 'header_image',
64-
'button_link' => 'https://athemes.com/botiga-upgrade?utm_source=theme_customizer_deep&utm_content=header_image&utm_medium=button&utm_campaign=Botiga',
65-
'all_features_link' => 'https://athemes.com/theme/botiga/?utm_source=theme_customizer_deep&utm_content=header_image_all_features&utm_medium=button&utm_campaign=Botiga#see-all-features',
64+
'button_link' => botiga_upgrade_link( 'theme_customizer_deep', 'header_image' ),
65+
'all_features_link' => botiga_upgrade_link( 'theme_customizer_deep', 'Header Image All Features Link', '#see-all-features' ),
6666
'priority' => 999,
6767
)
6868
)
@@ -99,8 +99,8 @@
9999
'link_text' => esc_html__( 'many other premium features!', 'botiga' ),
100100
),
101101
'section' => 'botiga_section_typography_general',
102-
'button_link' => 'https://athemes.com/botiga-upgrade?utm_source=theme_customizer_deep&utm_content=typography_general&utm_medium=button&utm_campaign=Botiga',
103-
'all_features_link' => 'https://athemes.com/theme/botiga/?utm_source=theme_customizer_deep&utm_content=typography_general_all_features&utm_medium=button&utm_campaign=Botiga#see-all-features',
102+
'button_link' => botiga_upgrade_link( 'theme_customizer_deep', 'typography_general' ),
103+
'all_features_link' => botiga_upgrade_link( 'theme_customizer_deep', 'Typography General All Features Link', '#see-all-features' ),
104104
'priority' => 999,
105105
)
106106
)
@@ -134,8 +134,8 @@
134134
'link_text' => esc_html__( 'many other premium features!', 'botiga' ),
135135
),
136136
'section' => 'botiga_section_layout',
137-
'button_link' => 'https://athemes.com/botiga-upgrade?utm_source=theme_customizer_deep&utm_content=site_layout&utm_medium=button&utm_campaign=Botiga',
138-
'all_features_link' => 'https://athemes.com/theme/botiga/?utm_source=theme_customizer_deep&utm_content=site_layout_all_features&utm_medium=button&utm_campaign=Botiga#see-all-features',
137+
'button_link' => botiga_upgrade_link( 'theme_customizer_deep', 'site_layout' ),
138+
'all_features_link' => botiga_upgrade_link( 'theme_customizer_deep', 'Site Layout All Features Link', '#see-all-features' ),
139139
'priority' => 999,
140140
)
141141
)
@@ -169,8 +169,8 @@
169169
esc_html__( 'Social share buttons', 'botiga' ),
170170
),
171171
'section' => 'botiga_section_blog_singles',
172-
'button_link' => 'https://athemes.com/botiga-upgrade?utm_source=theme_customizer_deep&utm_content=blog_single&utm_medium=button&utm_campaign=Botiga',
173-
'all_features_link' => 'https://athemes.com/theme/botiga/?utm_source=theme_customizer_deep&utm_content=blog_single_all_features&utm_medium=button&utm_campaign=Botiga#see-all-features',
172+
'button_link' => botiga_upgrade_link( 'theme_customizer_deep', 'blog_single' ),
173+
'all_features_link' => botiga_upgrade_link( 'theme_customizer_deep', 'Blog Single All Features Link', '#see-all-features' ),
174174
'priority' => 999,
175175
)
176176
)
@@ -200,8 +200,8 @@
200200
esc_html__( '5+ layout variations', 'botiga' ),
201201
),
202202
'section' => 'botiga_section_single_product_tabs',
203-
'button_link' => 'https://athemes.com/botiga-upgrade?utm_source=theme_customizer_deep&utm_content=single_product_tabs&utm_medium=button&utm_campaign=Botiga',
204-
'all_features_link' => 'https://athemes.com/theme/botiga/?utm_source=theme_customizer_deep&utm_content=single_product_tabs_all_features&utm_medium=button&utm_campaign=Botiga#see-all-features',
203+
'button_link' => botiga_upgrade_link( 'theme_customizer_deep', 'single_product_tabs' ),
204+
'all_features_link' => botiga_upgrade_link( 'theme_customizer_deep', 'Single Product Tabs All Features Link', '#see-all-features' ),
205205
'priority' => 999,
206206
)
207207
)
@@ -232,8 +232,8 @@
232232
esc_html__( 'Product spacing control', 'botiga' ),
233233
),
234234
'section' => 'woocommerce_product_catalog',
235-
'button_link' => 'https://athemes.com/botiga-upgrade?utm_source=theme_customizer_deep&utm_content=shop_archive_layout&utm_medium=button&utm_campaign=Botiga',
236-
'all_features_link' => 'https://athemes.com/theme/botiga/?utm_source=theme_customizer_deep&utm_content=shop_archive_layout_all_features&utm_medium=button&utm_campaign=Botiga#see-all-features',
235+
'button_link' => botiga_upgrade_link( 'theme_customizer_deep', 'shop_archive_layout' ),
236+
'all_features_link' => botiga_upgrade_link( 'theme_customizer_deep', 'Shop Archive Layout All Features Link', '#see-all-features' ),
237237
'priority' => 999,
238238
)
239239
)
@@ -264,8 +264,8 @@
264264
esc_html__( 'A cool product image swap effect', 'botiga' ),
265265
),
266266
'section' => 'botiga_section_shop_archive_product_card',
267-
'button_link' => 'https://athemes.com/botiga-upgrade?utm_source=theme_customizer_deep&utm_content=shop_archive_product_card&utm_medium=button&utm_campaign=Botiga',
268-
'all_features_link' => 'https://athemes.com/theme/botiga/?utm_source=theme_customizer_deep&utm_content=shop_archive_product_card_all_features&utm_medium=button&utm_campaign=Botiga#see-all-features',
267+
'button_link' => botiga_upgrade_link( 'theme_customizer_deep', 'shop_archive_product_card' ),
268+
'all_features_link' => botiga_upgrade_link( 'theme_customizer_deep', 'Shop Archive Product Card All Features Link', '#see-all-features' ),
269269
'priority' => 999,
270270
)
271271
)
@@ -296,8 +296,8 @@
296296
esc_html__( 'An option to show a quantity picker inside the mini cart', 'botiga' ),
297297
),
298298
'section' => 'botiga_section_shop_cart',
299-
'button_link' => 'https://athemes.com/botiga-upgrade?utm_source=theme_customizer_deep&utm_content=cart&utm_medium=button&utm_campaign=Botiga',
300-
'all_features_link' => 'https://athemes.com/theme/botiga/?utm_source=theme_customizer_deep&utm_content=cart_all_features&utm_medium=button&utm_campaign=Botiga#see-all-features',
299+
'button_link' => botiga_upgrade_link( 'theme_customizer_deep', 'cart' ),
300+
'all_features_link' => botiga_upgrade_link( 'theme_customizer_deep', 'Cart All Features Link', '#see-all-features' ),
301301
'priority' => 999,
302302
)
303303
)
@@ -328,8 +328,8 @@
328328
esc_html__( 'A distraction-free checkout page', 'botiga' ),
329329
),
330330
'section' => 'woocommerce_checkout',
331-
'button_link' => 'https://athemes.com/botiga-upgrade?utm_source=theme_customizer_deep&utm_content=checkout&utm_medium=button&utm_campaign=Botiga',
332-
'all_features_link' => 'https://athemes.com/theme/botiga/?utm_source=theme_customizer_deep&utm_content=checkout_all_features&utm_medium=button&utm_campaign=Botiga#see-all-features',
331+
'button_link' => botiga_upgrade_link( 'theme_customizer_deep', 'checkout' ),
332+
'all_features_link' => botiga_upgrade_link( 'theme_customizer_deep', 'Checkout All Features Link', '#see-all-features' ),
333333
'priority' => 999,
334334
)
335335
)
@@ -353,7 +353,7 @@
353353
esc_html__( 'A \'Footer Copyright Menu\' location', 'botiga' ),
354354
),
355355
'panel' => 'nav_menus',
356-
'button_link' => 'https://athemes.com/botiga-upgrade?utm_source=theme_customizer_deep&utm_content=menus&utm_medium=button&utm_campaign=Botiga',
356+
'button_link' => botiga_upgrade_link( 'theme_customizer_deep', 'menus' ),
357357
'priority' => 999,
358358
)
359359
)
@@ -382,8 +382,8 @@
382382
'title' => __( 'More footer copyright options available in PRO version.', 'botiga' ),
383383
'display_thumb' => false,
384384
'section' => 'botiga_section_footer_credits',
385-
'button_link' => 'https://athemes.com/botiga-upgrade?utm_source=theme_customizer_deep&utm_content=footer_copyright&utm_medium=button&utm_campaign=Botiga',
386-
'all_features_link' => 'https://athemes.com/theme/botiga/?utm_source=theme_customizer_deep&utm_content=footer_copyright_all_features&utm_medium=button&utm_campaign=Botiga#see-all-features',
385+
'button_link' => botiga_upgrade_link( 'theme_customizer_deep', 'footer_copyright' ),
386+
'all_features_link' => botiga_upgrade_link( 'theme_customizer_deep', 'Footer Copyright All Features Link', '#see-all-features' ),
387387
'priority' => 999,
388388
)
389389
)

inc/customizer/upsell/class-customize.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function sections( $manager ) {
7373
'botiga_upsell',
7474
array(
7575
'pro_text' => esc_html__( 'View Pro Features', 'botiga' ),
76-
'pro_url' => 'https://athemes.com/botiga-upgrade?utm_source=theme_customizer&utm_content=view_pro_features&utm_medium=botiga_customizer&utm_campaign=Botiga',
76+
'pro_url' => botiga_upgrade_link( 'theme_customizer', 'View Pro Features Button' ),
7777
'priority' => -999,
7878
)
7979
)

inc/dashboard/class-dashboard-settings.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,17 @@ function botiga_dashboard_settings() {
4343
//
4444
// Upgrade to Pro.
4545
//
46-
$settings['upgrade_pro'] = 'https://athemes.com/botiga-upgrade?utm_source=theme_info&utm_medium=link&utm_campaign=Botiga';
47-
$settings['tb_upgrade_pro'] = 'https://athemes.com/botiga-upgrade?utm_source=templates_builder&utm_medium=link&utm_campaign=Botiga';
48-
$settings['pf_upgrade_pro'] = 'https://athemes.com/botiga-upgrade?utm_source=product_filters&utm_medium=link&utm_campaign=Botiga';
46+
$settings['upgrade_pro'] = botiga_upgrade_link( 'theme_info' );
47+
$settings['tb_upgrade_pro'] = botiga_upgrade_link( 'templates_builder' );
48+
$settings['pf_upgrade_pro'] = botiga_upgrade_link( 'product_filters' );
4949

5050
//
5151
// Promo.
5252
//
5353
$settings['promo_title'] = esc_html__('Upgrade to Pro', 'botiga');
5454
$settings['promo_desc'] = esc_html__('Take Botiga to a whole other level by upgrading to the Pro version.', 'botiga');
5555
$settings['promo_button'] = esc_html__('Discover Botiga Pro', 'botiga');
56-
$settings['promo_link'] = 'https://athemes.com/botiga-upgrade?utm_source=theme_info&utm_medium=link&utm_campaign=Botiga';
56+
$settings['promo_link'] = botiga_upgrade_link( 'theme_info' );
5757

5858
//
5959
// Review.
@@ -70,7 +70,7 @@ function botiga_dashboard_settings() {
7070
// Support.
7171
//
7272
$settings['support_link'] = 'https://athemes.com/support/';
73-
$settings['support_pro_link'] = 'https://athemes.com/botiga-upgrade?utm_source=theme_support&utm_medium=button&utm_campaign=Botiga';
73+
$settings['support_pro_link'] = botiga_upgrade_link( 'theme_support' );
7474

7575
//
7676
// Community.
@@ -882,7 +882,7 @@ function botiga_demos_settings($settings) {
882882
// Pro.
883883
$settings['has_pro'] = false;
884884
$settings['pro_label'] = esc_html__('Get Pro', 'botiga');
885-
$settings['pro_link'] = 'https://athemes.com/botiga-upgrade/?utm_source=theme_table&utm_medium=button&utm_campaign=Botiga';
885+
$settings['pro_link'] = botiga_upgrade_link( 'theme_table' );
886886

887887
return $settings;
888888
}

inc/dashboard/class-dashboard.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public function add_menu_page() {
224224
esc_html__('Upgrade to Pro', 'botiga'),
225225
esc_html__('Upgrade to Pro', 'botiga'),
226226
'manage_options',
227-
'https://athemes.com/botiga-upgrade?utm_source=theme_submenu_page&utm_medium=button&utm_campaign=Botiga',
227+
botiga_upgrade_link( 'theme_submenu_page' ),
228228
'',
229229
6
230230
);
@@ -242,14 +242,14 @@ public function add_admin_footer_internal_scripts() {
242242
#adminmenu .toplevel_page_botiga-dashboard .wp-submenu a[href="admin.php?page=botiga-dashboard"] {
243243
display: none;
244244
}
245-
#adminmenu .toplevel_page_botiga-dashboard .wp-submenu a[href="https://athemes.com/botiga-upgrade?utm_source=theme_submenu_page&utm_medium=button&utm_campaign=Botiga"] {
245+
#adminmenu .toplevel_page_botiga-dashboard .wp-submenu a[href="<?php echo esc_url( botiga_upgrade_link( 'theme_submenu_page' ) ); ?>"] {
246246
background-color: green;
247247
color: #FFF;
248248
}
249249
</style>
250250
<script type="text/javascript">
251251
document.addEventListener("DOMContentLoaded", function() {
252-
const botigaUpsellMenuItem = document.querySelector( '#adminmenu .toplevel_page_botiga-dashboard .wp-submenu a[href="https://athemes.com/botiga-upgrade?utm_source=theme_submenu_page&utm_medium=button&utm_campaign=Botiga"]' );
252+
const botigaUpsellMenuItem = document.querySelector( '#adminmenu .toplevel_page_botiga-dashboard .wp-submenu a[href="<?php echo esc_url( botiga_upgrade_link( 'theme_submenu_page' ) ); ?>"]' );
253253

254254
if ( ! botigaUpsellMenuItem ) {
255255
return;

inc/dashboard/html-free-vs-pro.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@
590590
</div>
591591

592592
<div class="botiga-dashboard-freevspro-upsell-wrapper">
593-
<a href="https://athemes.com/botiga-upgrade?utm_source=theme_dashboard&utm_content=free_vs_pro_table&utm_medium=link&utm_campaign=Botiga" class="button button-primary bt-mt-20px" target="_blank">
593+
<a href="<?php echo esc_url( botiga_upgrade_link( 'theme_dashboard', 'Free Vs Pro Table Button' ) ); ?>" class="button button-primary bt-mt-20px" target="_blank">
594594
<?php echo esc_html__( 'Upgrade To Pro Today', 'botiga' ); ?>
595595
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
596596
<path d="M11.4375 0H8.25C7.94531 0 7.66406 0.1875 7.54688 0.492188C7.42969 0.773438 7.5 1.10156 7.71094 1.3125L8.67188 2.27344L4.14844 6.79688C3.84375 7.07812 3.84375 7.57031 4.14844 7.85156C4.28906 7.99219 4.47656 8.0625 4.6875 8.0625C4.875 8.0625 5.0625 7.99219 5.20312 7.85156L9.72656 3.32812L10.6875 4.28906C10.8281 4.42969 11.0156 4.5 11.2266 4.5C11.3203 4.5 11.4141 4.5 11.5078 4.45312C11.8125 4.33594 12 4.05469 12 3.75V0.5625C12 0.257812 11.7422 0 11.4375 0ZM9.1875 7.5C8.85938 7.5 8.625 7.75781 8.625 8.0625V10.6875C8.625 10.8047 8.53125 10.875 8.4375 10.875H1.3125C1.19531 10.875 1.125 10.8047 1.125 10.6875V3.5625C1.125 3.46875 1.19531 3.375 1.3125 3.375H3.9375C4.24219 3.375 4.5 3.14062 4.5 2.8125C4.5 2.50781 4.24219 2.25 3.9375 2.25H1.3125C0.585938 2.25 0 2.85938 0 3.5625V10.6875C0 11.4141 0.585938 12 1.3125 12H8.4375C9.14062 12 9.75 11.4141 9.75 10.6875V8.0625C9.75 7.75781 9.49219 7.5 9.1875 7.5Z" fill="#3858E9"/>

0 commit comments

Comments
 (0)