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,73 +10,64 @@ 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>
<!-- Google Tag Manager (noscript) --> {% if jekyll.environment == 'production' and site.google_analytics.id != empty and site.google_analytics.id %}
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-W4PKSB86" <!-- Google Tag Manager (noscript) -->
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-W4PKSB86" height="0" width="0"
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 %}
<div id="main-wrapper" class="d-flex justify-content-center"> <div id="main-wrapper" class="d-flex justify-content-center">
<div id="main" class="container px-xxl-5"> <div id="main" class="container px-xxl-5">
{% include topbar.html lang=lang %} {% include topbar.html lang=lang %}
{{ content }} {{ content }}
{% include_cached search-results.html lang=lang %} {% include_cached search-results.html lang=lang %}
</div>
</div> </div>
</div>
{% include_cached footer.html lang=lang %} {% include_cached footer.html lang=lang %}
<div id="mask"></div> <div id="mask"></div>
<button id="back-to-top" aria-label="back-to-top" class="btn btn-lg btn-box-shadow"> <button id="back-to-top" aria-label="back-to-top" class="btn btn-lg btn-box-shadow">
<i class="fas fa-angle-up"></i> <i class="fas fa-angle-up"></i>
</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" <div class="toast-header">
role="alert" <button type="button" class="btn-close ms-auto" data-bs-dismiss="toast" aria-label="Close"></button>
aria-live="assertive" </div>
aria-atomic="true" <div class="toast-body text-center pt-0">
data-bs-animation="true" <p class="px-2 mb-3">{{ site.data.locales[lang].notification.update_found }}</p>
data-bs-autohide="false" <button type="button" class="btn btn-primary" aria-label="Update">
> {{ site.data.locales[lang].notification.update }}
<div class="toast-header"> </button>
<button </div>
type="button" </div>
class="btn-close ms-auto" {% endif %}
data-bs-dismiss="toast"
aria-label="Close"
></button>
</div>
<div class="toast-body text-center pt-0">
<p class="px-2 mb-3">{{ site.data.locales[lang].notification.update_found }}</p>
<button type="button" class="btn btn-primary" aria-label="Update">
{{ site.data.locales[lang].notification.update }}
</button>
</div>
</div>
{% endif %}
{% include js-selector.html %} {% include js-selector.html %}
{% if page.mermaid %} {% if page.mermaid %}
{% include mermaid.html %} {% include mermaid.html %}
{% endif %} {% endif %}
{% include_cached search-loader.html %}
</body>
{% include_cached search-loader.html %}
</body>
</html> </html>