This commit is contained in:
Kristian Polso 2018-06-09 19:52:19 +03:00 committed by Jeremy Kauffman
parent a102898daf
commit 9a551c0c6f
3 changed files with 16 additions and 8 deletions

View file

@ -1,10 +1,4 @@
<?php if (IS_PRODUCTION): ?>
<style>.async-hide { opacity: 0 !important} </style>
<script>(function(a,s,y,n,c,h,i,d,e){s.className+=' '+y;h.start=1*new Date;
h.end=i=function(){s.className=s.className.replace(RegExp(' ?'+y),'')};
(a[n]=a[n]||[]).hide=h;setTimeout(function(){i();h.end=null},c);h.timeout=c;
})(window,document.documentElement,'async-hide','dataLayer',4000,
{'GTM-NT8579P':true});</script>
<script>
<?php //google analytics?>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
@ -25,6 +19,6 @@ h.end=i=function(){s.className=s.className.replace(RegExp(' ?'+y),'')};
<?php else: ?>
<script>
window.ga = function() { };
console.log('Analytics partial skipped because this is a non-production instance.');
console.log('Analytics footer partial skipped because this is a non-production instance.');
</script>
<?php endif ?>

View file

@ -0,0 +1,12 @@
<?php if (IS_PRODUCTION): ?>
<style>.async-hide { opacity: 0 !important} </style>
<script>(function(a,s,y,n,c,h,i,d,e){s.className+=' '+y;h.start=1*new Date;
h.end=i=function(){s.className=s.className.replace(RegExp(' ?'+y),'')};
(a[n]=a[n]||[]).hide=h;setTimeout(function(){i();h.end=null},c);h.timeout=c;
})(window,document.documentElement,'async-hide','dataLayer',4000,
{'GTM-NT8579P':true});</script>
<?php else: ?>
<script>
console.log('Analytics head partial skipped because this is a non-production instance.');
</script>
<?php endif ?>

View file

@ -54,6 +54,8 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<base target="_parent" />
<?php echo View::render('layout/_analytics_head') ?>
</head>
<body>
<?php echo $content ?>
@ -66,7 +68,7 @@
<?php foreach (Response::getJsAssets() as $src): ?>
<script src="<?php echo $src ?>"></script>
<?php endforeach ?>
<?php echo View::render('layout/_analytics') ?>
<?php echo View::render('layout/_analytics_footer') ?>
<?php $js = Response::getJsCalls() ?>
<?php if ($js): ?>
<script><?php echo implode("\n", $js) ?></script>