Upgrade GA tag (analytics.js) to the latest tag (gtag.js)
This commit is contained in:
parent
db5a58638d
commit
3c2675c4a1
3 changed files with 13 additions and 13 deletions
|
@ -5,12 +5,12 @@
|
||||||
© 2017-2019 Cotes Chung
|
© 2017-2019 Cotes Chung
|
||||||
MIT License
|
MIT License
|
||||||
-->
|
-->
|
||||||
|
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||||
|
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics.id }}"></script>
|
||||||
<script>
|
<script>
|
||||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
window.dataLayer = window.dataLayer || [];
|
||||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
function gtag(){dataLayer.push(arguments);}
|
||||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
|
||||||
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
gtag('js', new Date());
|
||||||
|
gtag('config', '{{ site.google_analytics.id }}');
|
||||||
ga('create', '{{ site.google_analytics.id }}', 'auto');
|
|
||||||
ga('send', 'pageview');
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -35,7 +35,11 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
<!-- PWA -->
|
|
||||||
{% if jekyll.environment == 'production' %}
|
{% if jekyll.environment == 'production' %}
|
||||||
|
|
||||||
|
{% include google-analytics.html %}
|
||||||
|
|
||||||
|
<!-- PWA -->
|
||||||
<script src="{{ '/app.js' | relative_url }}" defer></script>
|
<script src="{{ '/app.js' | relative_url }}" defer></script>
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -52,12 +52,8 @@ layout: compress
|
||||||
<i class="fas fa-angle-up"></i>
|
<i class="fas fa-angle-up"></i>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
{% if jekyll.environment == 'production' %}
|
|
||||||
{% include google-analytics.html %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% include search-loader.html %}
|
{% include search-loader.html %}
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue