Delay GA loading
This commit is contained in:
parent
cdaa79cf80
commit
63f57fbc12
3 changed files with 14 additions and 10 deletions
|
@ -6,11 +6,13 @@
|
||||||
MIT License
|
MIT License
|
||||||
-->
|
-->
|
||||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics.id }}"></script>
|
<script defer src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics.id }}"></script>
|
||||||
<script>
|
<script>
|
||||||
window.dataLayer = window.dataLayer || [];
|
document.addEventListener("DOMContentLoaded", function(event) {
|
||||||
function gtag(){dataLayer.push(arguments);}
|
window.dataLayer = window.dataLayer || [];
|
||||||
|
function gtag(){dataLayer.push(arguments);}
|
||||||
|
|
||||||
gtag('js', new Date());
|
gtag('js', new Date());
|
||||||
gtag('config', '{{ site.google_analytics.id }}');
|
gtag('config', '{{ site.google_analytics.id }}');
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -25,4 +25,10 @@
|
||||||
{% if jekyll.environment == 'production' %}
|
{% if jekyll.environment == 'production' %}
|
||||||
<!-- PWA -->
|
<!-- PWA -->
|
||||||
<script defer src="{{ '/app.js' | relative_url }}"></script>
|
<script defer src="{{ '/app.js' | relative_url }}"></script>
|
||||||
|
|
||||||
|
<!-- GA -->
|
||||||
|
{% if site.google_analytics.id %}
|
||||||
|
{% include google-analytics.html %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -52,10 +52,6 @@ layout: compress
|
||||||
|
|
||||||
{% include search-loader.html %}
|
{% include search-loader.html %}
|
||||||
|
|
||||||
{% if site.google_analytics.id and jekyll.environment == 'production' %}
|
|
||||||
{% include google-analytics.html %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue