Skip to content

Commit a7ae6cd

Browse files
committed
Fix TOS and GA in Setup Guide
1 parent 3e02a5c commit a7ae6cd

File tree

2 files changed

+43
-25
lines changed

2 files changed

+43
-25
lines changed

SetupGuide_Plugin_Admin.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,13 +889,14 @@ public function config_imageservice() {
889889
* @since 2.0.0
890890
* @access private
891891
*
892+
* @see Util_Environment::is_w3tc_pro()
892893
* @see Licensing_Core::get_tos_choice()
893894
*
894895
* @return bool
895896
*/
896897
private function maybe_ask_tos() {
897898
$config = new Config();
898-
if ( Util_Environment::is_pro_constant( $config ) ) {
899+
if ( Util_Environment::is_w3tc_pro( $config ) ) {
899900
return false;
900901
}
901902

@@ -960,6 +961,11 @@ private function get_config() {
960961
'w3tc_install_date' => get_option( 'w3tc_install_date' ),
961962
'w3tc_edition' => esc_attr( Util_Environment::w3tc_edition( $config ) ),
962963
'list_widgets' => esc_attr( Util_Widget::list_widgets() ),
964+
'w3tc_pro' => Util_Environment::is_w3tc_pro( $config ),
965+
'w3tc_has_key' => $config->get_string( 'plugin.license_key' ),
966+
'w3tc_pro_c' => defined( 'W3TC_PRO' ) && W3TC_PRO,
967+
'w3tc_enterprise_c' => defined( 'W3TC_ENTERPRISE' ) && W3TC_ENTERPRISE,
968+
'w3tc_plugin_type' => esc_attr( $config->get_string( 'plugin.type' ) ),
963969
'ga_profile' => ( defined( 'W3TC_DEVELOPER' ) && W3TC_DEVELOPER ) ? 'G-Q3CHQJWERM' : 'G-5TFS8M5TTY',
964970
'tos_choice' => Licensing_Core::get_tos_choice(),
965971
'track_usage' => $config->get_boolean( 'common.track_usage' ),

pub/js/setup-guide.js

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -70,30 +70,42 @@ jQuery(function() {
7070

7171
window.dataLayer = window.dataLayer || [];
7272

73-
const w3tc_ga = function() { dataLayer.push( arguments ); }
74-
75-
if (window.w3tc_ga) {
76-
w3tc_enable_ga = true;
77-
78-
w3tc_ga( 'js', new Date() );
79-
80-
w3tc_ga( 'config', W3TC_SetupGuide.ga_profile, {
81-
'user_properties': {
82-
'plugin': 'w3-total-cache',
83-
'w3tc_version': W3TC_SetupGuide.w3tc_version,
84-
'wp_version': W3TC_SetupGuide.wp_version,
85-
'php_version': W3TC_SetupGuide.php_version,
86-
'server_software': W3TC_SetupGuide.server_software,
87-
'wpdb_version': W3TC_SetupGuide.db_version,
88-
'home_url': W3TC_SetupGuide.home_url_host,
89-
'w3tc_install_version': W3TC_SetupGuide.install_version,
90-
'w3tc_edition': W3TC_SetupGuide.w3tc_edition,
91-
'w3tc_widgets': W3TC_SetupGuide.list_widgets,
92-
'page': W3TC_SetupGuide.page,
93-
'w3tc_install_date': W3TC_SetupGuide.w3tc_install_date,
94-
}
95-
});
96-
}
73+
window.w3tc_ga = function() { dataLayer.push( arguments ); }
74+
75+
w3tc_enable_ga = true;
76+
77+
w3tc_ga( 'js', new Date() );
78+
79+
w3tc_ga( 'config', W3TC_SetupGuide.ga_profile, {
80+
'user_properties': {
81+
'plugin': 'w3-total-cache',
82+
'w3tc_version': W3TC_SetupGuide.w3tc_version,
83+
'wp_version': W3TC_SetupGuide.wp_version,
84+
'php_version': W3TC_SetupGuide.php_version,
85+
'server_software': W3TC_SetupGuide.server_software,
86+
'wpdb_version': W3TC_SetupGuide.db_version,
87+
'home_url': W3TC_SetupGuide.home_url_host,
88+
'w3tc_install_version': W3TC_SetupGuide.install_version,
89+
'w3tc_edition': W3TC_SetupGuide.w3tc_edition,
90+
'w3tc_widgets': W3TC_SetupGuide.list_widgets,
91+
'page': W3TC_SetupGuide.page,
92+
'w3tc_install_date': W3TC_SetupGuide.w3tc_install_date,
93+
'w3tc_pro': W3TC_SetupGuide.w3tc_pro,
94+
'w3tc_has_key': W3TC_SetupGuide.w3tc_has_key,
95+
'w3tc_pro_c': W3TC_SetupGuide.w3tc_pro_c,
96+
'w3tc_enterprise_c': W3TC_SetupGuide.w3tc_enterprise_c,
97+
'w3tc_plugin_type': W3TC_SetupGuide.plugin_type,
98+
}
99+
});
100+
101+
w3tc_ga(
102+
'event',
103+
'button',
104+
{
105+
eventCategory: 'w3tc_setup_guide',
106+
eventLabel: 'w3tc-wizard-step-welcome'
107+
}
108+
);
97109
}
98110
});
99111
}

0 commit comments

Comments
 (0)