From 3bd19c2b979700ca4ee81b58a390b5bf93a04a2d Mon Sep 17 00:00:00 2001 From: Shivioua Date: Thu, 5 Jan 2023 23:09:29 +0100 Subject: [PATCH] Add support for GA4 for theme slate Google Analytics version 4. --- README.md | 3 +++ _config.yml | 1 + _includes/head-custom-google-analytics.html | 10 ++++++++++ 3 files changed, 14 insertions(+) diff --git a/README.md b/README.md index d49c671c..588f52d8 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ Additionally, you may choose to set the following optional variables: ```yml show_downloads: ["true" or "false" (unquoted) to indicate whether to provide a download URL] google_analytics: [Your Google Analytics tracking ID] +google_analytics_v4: [Your Google Analytics version 4 (GA4) tracking ID] ``` ### Stylesheet @@ -70,6 +71,8 @@ If you'd like to change the theme's HTML layout: ### Customizing Google Analytics code + + Google has released several iterations to their Google Analytics code over the years since this theme was first created. If you would like to take advantage of the latest code, paste it into `_includes/head-custom-google-analytics.html` in your Jekyll site. ### Overriding GitHub-generated URLs diff --git a/_config.yml b/_config.yml index 635274fc..19296e9c 100644 --- a/_config.yml +++ b/_config.yml @@ -2,4 +2,5 @@ title: Slate theme description: Slate is a theme for GitHub Pages. show_downloads: true google_analytics: +google_analytics_v4: theme: jekyll-theme-slate diff --git a/_includes/head-custom-google-analytics.html b/_includes/head-custom-google-analytics.html index 8a3ae5c9..18c771fd 100644 --- a/_includes/head-custom-google-analytics.html +++ b/_includes/head-custom-google-analytics.html @@ -8,3 +8,13 @@ ga('send', 'pageview'); {% endif %} +{% if site.google_analytics_v4 %} + + + +{% endif %}