Skip to content

Commit

Permalink
fix: do not load GTM container when OFF and console.log OFF
Browse files Browse the repository at this point in the history
  • Loading branch information
morvy authored Mar 11, 2024
1 parent 3083143 commit e2dae8a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion public/frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -1041,9 +1041,11 @@ function gtm4wp_wp_header_begin( $echo = true ) {
do_action( GTM4WP_WPACTION_AFTER_DATALAYER );

$output_container_code = true;
if ( ( GTM4WP_PLACEMENT_OFF === $gtm4wp_options[ GTM4WP_OPTION_GTM_PLACEMENT ] ) && ( ! $no_console_log ) ) {
if ( GTM4WP_PLACEMENT_OFF === $gtm4wp_options[ GTM4WP_OPTION_GTM_PLACEMENT ] ) {
$output_container_code = false;
}

if ( ! $no_console_log && ! $output_container_code ) {
echo '
<script' . ( $has_html5_support ? '' : ' type="text/javascript"' ) . ( $add_cookiebot_ignore ? ' data-cookieconsent="ignore"' : '' ) . '>
console.warn && console.warn("[GTM4WP] Google Tag Manager container code placement set to OFF !!!");
Expand Down

0 comments on commit e2dae8a

Please sign in to comment.