From 1a9919951d8f325c23b9e2c15eba10d9aaafb031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20E=2E=20Fern=C3=A1ndez?= Date: Mon, 5 Mar 2018 20:06:13 +0100 Subject: [PATCH] Add support for Google Analytics with global site tag (gtag.js) 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 ae4fe9779f26..e1d8cc2c4f48 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 000000000000..31f2a6960f93 --- /dev/null +++ b/_includes/analytics-providers/google-gtag.html @@ -0,0 +1,9 @@ + + + diff --git a/_includes/analytics.html b/_includes/analytics.html index 5448a506dde0..371469f0af9b 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 8251ec6055f2..67e5ca95ab6d 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" ```