From a8915cd67a82f9b866cd293eece53ef4878427db Mon Sep 17 00:00:00 2001 From: Torben Lundsgaard Date: Tue, 3 Oct 2023 12:04:19 +0200 Subject: [PATCH] Fix possible naming collision with other GTM plugins --- src/Frontend/Frontend.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Frontend/Frontend.php b/src/Frontend/Frontend.php index c24cf9d..f5f0f7d 100644 --- a/src/Frontend/Frontend.php +++ b/src/Frontend/Frontend.php @@ -135,9 +135,9 @@ public function get_datalayer_content(): void { if ( $this->options->get( 'general', 'gtm_id' ) ) { $datalayer_data = apply_filters( 'gtmkit_datalayer_content', [] ); - echo 'const dataLayer_content = ' . wp_json_encode( $datalayer_data ) . ";\n"; + echo 'const gtmkit_dataLayer_content = ' . wp_json_encode( $datalayer_data ) . ";\n"; - echo esc_attr( $this->datalayer_name ) . '.push( dataLayer_content );' . "\n"; + echo esc_attr( $this->datalayer_name ) . '.push( gtmkit_dataLayer_content );' . "\n"; } echo "\n";