Changes new GA4 in Google Analytics

This commit is contained in:
Sukchan Lee 2022-09-26 14:29:19 +09:00
parent ce7d631064
commit 8b10dc1edc
2 changed files with 12 additions and 10 deletions

View File

@ -22,7 +22,7 @@ baseurl: "/open5gs" # the subpath of your site, e.g. /blog
url: "https://open5gs.org" # the base hostname & protocol for your site, e.g. http://example.com
author: "Sukchan Lee"
github_username: open5gs
google_analytics: UA-139225646-2
google_analytics: G-12MQZTB3JH
# Build settings
markdown: kramdown

View File

@ -1,10 +1,12 @@
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
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');
{% if jekyll.environment == "production" %}
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
ga('create', '{{ site.google_analytics }}', 'auto');
ga('send', 'pageview');
</script>
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', '{{ site.google_analytics }}');
</script>
{% endif %}