diff --git a/src/Frontend/Frontend.php b/src/Frontend/Frontend.php index 2fbc395..3dc7b72 100644 --- a/src/Frontend/Frontend.php +++ b/src/Frontend/Frontend.php @@ -137,7 +137,7 @@ public function enqueue_datalayer_content(): void { $script = 'const gtmkit_dataLayer_content = ' . wp_json_encode( $datalayer_data ) . ";\n"; $script .= esc_attr( $this->datalayer_name ) . '.push( gtmkit_dataLayer_content );' . "\n"; - wp_register_script( 'gtmkit-datalayer', '', [], GTMKIT_VERSION, [ 'in_footer' => false ] ); + wp_register_script( 'gtmkit-datalayer', '', [ 'gtmkit-container' ], GTMKIT_VERSION, [ 'in_footer' => false ] ); wp_enqueue_script( 'gtmkit-datalayer' ); wp_add_inline_script( 'gtmkit-datalayer', apply_filters( 'gtmkit_datalayer_script', $script ), 'before' ); } @@ -182,7 +182,7 @@ function (cb) { $script = ob_get_clean(); - wp_register_script( 'gtmkit-container', '', [ 'gtmkit-datalayer' ], GTMKIT_VERSION, [ 'in_footer' => false ] ); + wp_register_script( 'gtmkit-container', '', [ 'gtmkit' ], GTMKIT_VERSION, [ 'in_footer' => false ] ); wp_enqueue_script( 'gtmkit-container' ); wp_add_inline_script( 'gtmkit-container', $script ); }