From e8808d252c0454c0bd114bd7ba38123ec27a7a8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20J=2E=20Hurtado=20Ruesga?= Date: Sun, 1 Nov 2020 13:09:04 +0100 Subject: [PATCH 1/2] Add support for Google gtags (Google Analytics v4) --- README.md | 3 +++ _layouts/default.html | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/README.md b/README.md index 424e109..51a05ff 100644 --- a/README.md +++ b/README.md @@ -38,8 +38,11 @@ Additionally, you may choose to set the following optional variables: ```yml show_downloads: ["true" or "false" to indicate whether to provide a download URL] google_analytics: [Your Google Analytics tracking ID] +google_analytics_v4: [Your Google Analytics v4 (gtags) tracking ID] ``` +`google_analytics` and `google_analytics_v4` are incompatible, you have to choose one of them, if both are set the later takes precedence. + ### Stylesheet If you'd like to add your own custom styles: diff --git a/_layouts/default.html b/_layouts/default.html index aa65198..d749bbb 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -1,6 +1,17 @@ + {% if site.google_analytics_v4 %} + + + + {% endif %} @@ -35,6 +46,7 @@ {% if site.google_analytics %} + {% unless site.google_analytics_v4 %} + {% endunless %} {% endif %} From 7ce41dad5c368e2515c08507cd46e5c6a816dee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20J=2E=20Hurtado=20Ruesga?= Date: Wed, 4 Nov 2020 20:54:38 +0100 Subject: [PATCH 2/2] Move meta tags to the beginning of the head --- _layouts/default.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_layouts/default.html b/_layouts/default.html index d749bbb..a651639 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -1,6 +1,9 @@ + + + {% if site.google_analytics_v4 %} @@ -12,9 +15,6 @@ gtag('config', '{{ site.google_analytics_v4 }}'); {% endif %} - - - {% seo %}