Add Google Analytics GA4 code (Issue #45)

This commit is contained in:
paul 2021-02-06 12:02:54 +00:00
parent 695b83cea9
commit 6c49168d7f
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>