Merge pull request #48 from Kolossi/master

Add Google Analytics GA4 code (Issue #45)
This commit is contained in:
Amit Merchant 2021-02-16 09:21:17 +05:30 committed by GitHub
commit c6edc6db0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 0 deletions

View File

@ -43,6 +43,9 @@ disqus:
# Enter your Google Analytics web tracking code (e.g. UA-2110908-2) to activate tracking
google_analytics: UA-43339302-11
# For newer "GA4" analytics, use the following instead of the "UA" entry above
#google_analytics_ga4: G-GABC1DEFG
# Your website URL (e.g. http://amitmerchant1990.github.io or http://www.amitmerchant.com)
# Used for Sitemap.xml and your RSS feed
url: http://www.amitmerchant.com/reverie

View File

@ -0,0 +1,9 @@
{% if site.google_analytics_ga4 %}
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics_ga4 }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{ site.google_analytics_ga4 }}');
</script>
{% endif %}

View File

@ -11,6 +11,7 @@
<meta name="theme-color" content="#000000">
<link rel="icon" type="image/png" sizes="32x32" href="{{ site.baseurl }}/images/favicon-32x32.png">
{% include analytics_head.html %}
</head>
<body>