diff --git a/bootstrap.php b/bootstrap.php index a978f18..c90355b 100644 --- a/bootstrap.php +++ b/bootstrap.php @@ -43,6 +43,7 @@ define( 'GTM_SERVER_SIDE_ADMIN_GROUP_GENERAL', 'gtm-server-side-admin-group-general' ); define( 'GTM_SERVER_SIDE_ADMIN_GROUP_DATA_LAYER', 'gtm-server-side-admin-group-data-layer' ); define( 'GTM_SERVER_SIDE_ADMIN_GROUP_WEBHOOKS', 'gtm-server-side-admin-group-webhooks' ); +define( 'GTM_SENSITIVE_DATA_NOTICE', '' ); // Autoload plugin classes. spl_autoload_register( diff --git a/includes/class-gtm-server-side-admin-settings.php b/includes/class-gtm-server-side-admin-settings.php index 42af988..bf1752f 100644 --- a/includes/class-gtm-server-side-admin-settings.php +++ b/includes/class-gtm-server-side-admin-settings.php @@ -271,7 +271,7 @@ function() { ' . checked( GTM_Server_Side_Helpers::get_option( GTM_SERVER_SIDE_FIELD_DATA_LAYER_ECOMMERCE ), 'yes', false ) . ' value="yes">'; echo '
'; - esc_html_e( 'This option only works with Woocommerce shops. Adds basic events and their data: Login, SignUp, ViewItem, AddToCart, BeginCheckout, Purchase.', 'gtm-server-side' ); + esc_html_e( 'This option only works with Woocommerce shops. Adds basic events and their data: Login, SignUp, ViewItem, AddToCart, BeginCheckout, Purchase. On cached websites ensure to implement gtm_server_side_is_page_cached filter.', 'gtm-server-side' ); }, GTM_SERVER_SIDE_ADMIN_SLUG, GTM_SERVER_SIDE_ADMIN_GROUP_DATA_LAYER @@ -295,7 +295,7 @@ function() { ' . checked( GTM_Server_Side_Helpers::get_option( GTM_SERVER_SIDE_FIELD_DATA_LAYER_USER_DATA ), 'yes', false ) . ' value="yes">'; echo '
'; - esc_html_e( 'All events for authorised users will have their personal details (name, surname, email, etc.) available. Their billing details will be available on the purchase event.', 'gtm-server-side' ); + esc_html_e( 'All events for authorised users on uncached pages, will have their personal details (name, surname, email, etc.) available. Their billing details will be available on the purchase event. Page is marked as cached using `gtm_server_side_is_page_cached` filter.', 'gtm-server-side' ); }, GTM_SERVER_SIDE_ADMIN_SLUG, GTM_SERVER_SIDE_ADMIN_GROUP_DATA_LAYER diff --git a/includes/class-gtm-server-side-event-begincheckout.php b/includes/class-gtm-server-side-event-begincheckout.php index d591c30..42efe40 100644 --- a/includes/class-gtm-server-side-event-begincheckout.php +++ b/includes/class-gtm-server-side-event-begincheckout.php @@ -34,6 +34,10 @@ public function init() { * @return void */ public function wp_footer() { + if ( ! GTM_Server_Side_Helpers::can_output_sensitive_data() ) { + return; + } + if ( ! is_checkout() ) { return; } @@ -55,9 +59,10 @@ public function wp_footer() { ), ); - if ( GTM_Server_Side_WC_Helpers::instance()->is_enable_user_data() ) { + if ( GTM_Server_Side_WC_Helpers::instance()->should_output_user_data() ) { $data_layer['user_data'] = GTM_Server_Side_WC_Helpers::instance()->get_data_layer_user_data(); } + echo GTM_SENSITIVE_DATA_NOTICE; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>