This commit is contained in:
Gregory Pradun
2022-03-31 19:45:45 +03:00
parent a26943ff72
commit 0fce53a1dc

View File

@@ -1,7 +1,7 @@
<?php
require_once 'inc/walker-nav-menu.php';
$scripts = [];
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
@@ -34,16 +34,39 @@ require_once 'inc/walker-nav-menu.php';
var isHomeTemplate = true;
</script>
<?php endif;?>
<script src="https://www.googleoptimize.com/optimize.js?id=OPT-TCXZSGK"></script>
<?php $scripts[] = ['type' => 'script', 'source' =>"https://www.googleoptimize.com/optimize.js?id=OPT-TCXZSGK"]; ?>
<?php if (LAWCARTA_ENVIRONMENT_NAME == 'prod'):?>
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
<?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');</script>
<!-- End Google Tag Manager -->
})(window,document,'script','dataLayer','GTM-K8LWZ6K');"]; ?>
<?php $scripts[] = ['type' => 'comment', 'source' =>'End Google Tag Manager']; ?>
<?php endif;?>
<?php if(isset($_COOKIE['cookie_level']) && in_array($_COOKIE['cookie_level'],[1,2,3])):?>
<?php foreach($scripts as $script):?>
<?php switch($script['type']):
case 'comment': ?>
<!--<?=$script['type']?> -->
<?php break; ?>
<?php case 'style': ?>
<style><?=$script['source']?></style>
<?php break; ?>
<?php case 'script': ?>
<?php if(isset($script['src'])):?>
<script <?php if(isset($script['async'])):?>async<?php endif;?> src="<?=$script['src']?>"></script>
<?php else:?>
<script><?=$script['source']?></script>
<?php endif;?>
<?php break; ?>
<?php endswitch; ?>
<?php endforeach;?>
<?php endif; ?>
<script>
var scripts = <?php echo json_encode($scripts) ?>;
</script>
<script src="<?= get_lawcarta_url()?>/assets/track-enable">
<script>
function support_format_webp() {
var elem = document.createElement('canvas');