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

View File

@ -10,73 +10,64 @@ layout: compress
{% include lang.html %}
{% capture prefer_mode %}
{% if site.theme_mode %}
data-mode="{{ site.theme_mode }}"
{% endif %}
{% if site.theme_mode %}
data-mode="{{ site.theme_mode }}"
{% endif %}
{% endcapture %}
<!-- `site.alt_lang` can specify a language different from the UI -->
<html lang="{{ site.alt_lang | default: site.lang }}" {{ prefer_mode }}>
{% include head.html %}
{% include head.html %}
<body>
<body>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-W4PKSB86"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
{% if jekyll.environment == 'production' and site.google_analytics.id != empty and site.google_analytics.id %}
<!-- Google Tag Manager (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) -->
{% endif %}
{% include sidebar.html lang=lang %}
{% include sidebar.html lang=lang %}
<div id="main-wrapper" class="d-flex justify-content-center">
<div id="main" class="container px-xxl-5">
{% include topbar.html lang=lang %}
{{ content }}
{% include_cached search-results.html lang=lang %}
</div>
<div id="main-wrapper" class="d-flex justify-content-center">
<div id="main" class="container px-xxl-5">
{% include topbar.html lang=lang %}
{{ content }}
{% include_cached search-results.html lang=lang %}
</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">
<i class="fas fa-angle-up"></i>
</button>
<button id="back-to-top" aria-label="back-to-top" class="btn btn-lg btn-box-shadow">
<i class="fas fa-angle-up"></i>
</button>
{% if site.pwa.enabled %}
<div
id="notification"
class="toast"
role="alert"
aria-live="assertive"
aria-atomic="true"
data-bs-animation="true"
data-bs-autohide="false"
>
<div class="toast-header">
<button
type="button"
class="btn-close ms-auto"
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 %}
{% if site.pwa.enabled %}
<div id="notification" class="toast" role="alert" aria-live="assertive" aria-atomic="true" data-bs-animation="true"
data-bs-autohide="false">
<div class="toast-header">
<button type="button" class="btn-close ms-auto" 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 %}
{% include mermaid.html %}
{% endif %}
{% if page.mermaid %}
{% include mermaid.html %}
{% endif %}
{% include_cached search-loader.html %}
</body>
{% include_cached search-loader.html %}
</body>
</html>