// #region New GoogleAnalytics code
if (lhost){
    var measurement_id = "G-8W3ELS3KFC"
}
if (dev) {
    var measurement_id = "G-8W3ELS3KFC"
}
if (stg) {
    var measurement_id = "G-NC1L9ZF3TZ"
}
if (tst) {
    var measurement_id = "G-1VKNZWG6N7"
}
if (prod) {
    var measurement_id = "G-QT84BCZHEM"
}

console.log(measurement_id);

var ga_code_head = "<!-- Google Tag Manager --><script>(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','" + measurement_id + "');</script><!-- End Google Tag Manager -->"

var ga_code_body = "<!-- Google Tag Manager (noscript) --><noscript><iframe src='https://www.googletagmanager.com/ns.html?" + measurement_id + "' height='0' width='0' style='display:none;visibility:hidden'></iframe></noscript><!-- End Google Tag Manager (noscript) -->"

$('head').prepend(ga_code_head);
$('body').append(ga_code_body);
// #endregion


//#region Earlier GA code
// if (prod) {
//     var ga_token = "UA-74034219-1";
// }
// if(tst) {
//     var ga_token = "UA-123594055-1";
// }
// if(exp) {
//     var ga_token = "UA-193483924-1";
// }
// if(stg) {
//     var ga_token = "UA-106564172-1";
// }
// if(dev) {
//     var ga_token = "UA-123561271-1";
// }

// (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
// (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
// m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
// })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

// ga('create', ga_token, 'auto');
// ga('send', 'pageview');
//#endregion

// <!-- Google tag (gtag.js) -->
// <script async src="https://www.googletagmanager.com/gtag/js?id=G-38T3XGFF3Q"></script>
// <script>
//   window.dataLayer = window.dataLayer || [];
//   function gtag(){dataLayer.push(arguments);}
//   gtag('js', new Date());

//   gtag('config', 'G-38T3XGFF3Q');
// </script>
