diff --git a/includes/class-wc-google-gtag-js.php b/includes/class-wc-google-gtag-js.php index da6273de..9e5ee347 100644 --- a/includes/class-wc-google-gtag-js.php +++ b/includes/class-wc-google-gtag-js.php @@ -102,8 +102,8 @@ function %2$s(){dataLayer.push(arguments);} esc_js( $this->get( 'ga_id' ) ), esc_js( $this->tracker_function_name() ), esc_js( static::DEVELOPER_ID ), - wp_json_encode( $this->get_consent_modes() ), - wp_json_encode( $this->get_site_tag_config() ) + wp_json_encode( $this->get_consent_modes(), JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ), + wp_json_encode( $this->get_site_tag_config(), JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) ) ) ); @@ -162,6 +162,7 @@ public function inline_script_data(): void { 'events' => $this->get_enabled_events(), 'identifier' => $this->get( 'ga_product_identifier' ), ), + JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ), ) ); @@ -246,7 +247,7 @@ public function append_script_data( string $type, $data ): void { * @return string */ public function get_script_data(): string { - return wp_json_encode( $this->script_data ); + return wp_json_encode( $this->script_data, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ); } /**