Google analytics only enabled for production environment

This commit is contained in:
Bangara Raju Kottedi 2023-08-27 12:11:51 +05:30
parent a01c9dd184
commit 558425fa80
2 changed files with 48 additions and 56 deletions

View File

@ -102,7 +102,7 @@
}); });
} }
</script> </script>
{% if jekyll.environment == 'production' and site.google_analytics.id != empty and site.google_analytics.id %}
<!-- Google Tag Manager --> <!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': <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], new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
@ -110,6 +110,7 @@
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-W4PKSB86');</script> })(window,document,'script','dataLayer','GTM-W4PKSB86');</script>
<!-- End Google Tag Manager --> <!-- End Google Tag Manager -->
{% endif %}
{% unless site.theme_mode %} {% unless site.theme_mode %}
{% include mode-toggle.html %} {% include mode-toggle.html %}

View File

@ -10,21 +10,23 @@ layout: compress
{% include lang.html %} {% include lang.html %}
{% capture prefer_mode %} {% capture prefer_mode %}
{% if site.theme_mode %} {% if site.theme_mode %}
data-mode="{{ site.theme_mode }}" data-mode="{{ site.theme_mode }}"
{% endif %} {% endif %}
{% endcapture %} {% endcapture %}
<!-- `site.alt_lang` can specify a language different from the UI --> <!-- `site.alt_lang` can specify a language different from the UI -->
<html lang="{{ site.alt_lang | default: site.lang }}" {{ prefer_mode }}> <html lang="{{ site.alt_lang | default: site.lang }}" {{ prefer_mode }}>
{% include head.html %} {% include head.html %}
<body> <body>
{% if jekyll.environment == 'production' and site.google_analytics.id != empty and site.google_analytics.id %}
<!-- Google Tag Manager (noscript) --> <!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-W4PKSB86" <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-W4PKSB86" height="0" width="0"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) --> <!-- End Google Tag Manager (noscript) -->
{% endif %}
{% include sidebar.html lang=lang %} {% include sidebar.html lang=lang %}
@ -45,22 +47,10 @@ layout: compress
</button> </button>
{% if site.pwa.enabled %} {% if site.pwa.enabled %}
<div <div id="notification" class="toast" role="alert" aria-live="assertive" aria-atomic="true" data-bs-animation="true"
id="notification" data-bs-autohide="false">
class="toast"
role="alert"
aria-live="assertive"
aria-atomic="true"
data-bs-animation="true"
data-bs-autohide="false"
>
<div class="toast-header"> <div class="toast-header">
<button <button type="button" class="btn-close ms-auto" data-bs-dismiss="toast" aria-label="Close"></button>
type="button"
class="btn-close ms-auto"
data-bs-dismiss="toast"
aria-label="Close"
></button>
</div> </div>
<div class="toast-body text-center pt-0"> <div class="toast-body text-center pt-0">
<p class="px-2 mb-3">{{ site.data.locales[lang].notification.update_found }}</p> <p class="px-2 mb-3">{{ site.data.locales[lang].notification.update_found }}</p>
@ -78,5 +68,6 @@ layout: compress
{% endif %} {% endif %}
{% include_cached search-loader.html %} {% include_cached search-loader.html %}
</body> </body>
</html> </html>