enable GTM for all env

This commit is contained in:
Gregory Pradun
2022-04-28 13:32:20 +03:00
parent 283cd5dea5
commit 8e2f2f4325
7 changed files with 11 additions and 4 deletions

View File

@@ -49,15 +49,13 @@ $scripts = [];
</script>
<?php $scripts[] = ['type' => 'script', 'source' =>"https://www.googleoptimize.com/optimize.js?id=OPT-TCXZSGK"]; ?>
<?php if (LAWCARTA_ENVIRONMENT_NAME == 'prod'):?>
<?php $scripts[] = ['type' => 'comment', 'source' =>'Google Tag Manager']; ?>
<?php $scripts[] = ['type' => 'script', 'source' =>"(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-K8LWZ6K');"]; ?>
})(window,document,'script','dataLayer','".LC_GTM."');"]; ?>
<?php $scripts[] = ['type' => 'comment', 'source' =>'End Google Tag Manager']; ?>
<?php endif;?>
<?php if(
(isset($_COOKIE['cookie_level']) && in_array($_COOKIE['cookie_level'],['13','123']))
|| LC_ALLOW_COOKIE_POPUP == false
@@ -104,7 +102,7 @@ $scripts = [];
</head>
<body <?php body_class(); ?>>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-K8LWZ6K"
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=<?=LC_GTM ?>"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->