From 79d0b75683a4c13787b117e9e612073586fa21be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20E=2E=20Fern=C3=A1ndez?= Date: Tue, 13 Mar 2018 00:27:42 +0100 Subject: [PATCH] Add support for Google Analytics with global site tag (gtag.js) (#1563) For documentation see https://developers.google.com/analytics/devguides/collection/gtagjs/ and https://support.google.com/analytics/answer/7538414. --- _config.yml | 2 +- _includes/analytics-providers/google-gtag.html | 9 +++++++++ _includes/analytics.html | 2 ++ docs/_docs/05-configuration.md | 3 ++- 4 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 _includes/analytics-providers/google-gtag.html diff --git a/_config.yml b/_config.yml index ae4fe977..e1d8cc2c 100644 --- a/_config.yml +++ b/_config.yml @@ -83,7 +83,7 @@ social: # Analytics analytics: - provider : false # false (default), "google", "google-universal", "custom" + provider : false # false (default), "google", "google-universal", "google-gtag", "custom" google: tracking_id : diff --git a/_includes/analytics-providers/google-gtag.html b/_includes/analytics-providers/google-gtag.html new file mode 100644 index 00000000..31f2a696 --- /dev/null +++ b/_includes/analytics-providers/google-gtag.html @@ -0,0 +1,9 @@ + + + diff --git a/_includes/analytics.html b/_includes/analytics.html index 5448a506..371469f0 100644 --- a/_includes/analytics.html +++ b/_includes/analytics.html @@ -5,6 +5,8 @@ {% include /analytics-providers/google.html %} {% when "google-universal" %} {% include /analytics-providers/google-universal.html %} +{% when "google-gtag" %} + {% include /analytics-providers/google-gtag.html %} {% when "custom" %} {% include /analytics-providers/custom.html %} {% endcase %} diff --git a/docs/_docs/05-configuration.md b/docs/_docs/05-configuration.md index 8251ec60..67e5ca95 100644 --- a/docs/_docs/05-configuration.md +++ b/docs/_docs/05-configuration.md @@ -679,13 +679,14 @@ Analytics is disabled by default. To enable globally select one of the following | -------------------- | --------------------------------------------------------------- | | **google** | [Google Standard Analytics](https://www.google.com/analytics/) | | **google-universal** | [Google Universal Analytics](https://www.google.com/analytics/) | +| **google-gtag** | [Google Analytics Global Site Tag)](https://www.google.com/analytics/) | | **custom** | Other analytics providers | For Google Analytics add your Tracking Code: ```yaml analytics: - provider: "google-universal" + provider: "google-gtag" google: tracking_id: "UA-1234567-8" ```