Skip to content

Commit

Permalink
Merge pull request #329 from morvy/master
Browse files Browse the repository at this point in the history
FIX: do not load GTM container when OFF and console.log OFF
  • Loading branch information
duracelltomi authored Mar 12, 2024
2 parents 3083143 + e2dae8a commit 3194f86
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 3194f86

Please sign in to comment.