diff --git a/docs/api-site-config.md b/docs/api-site-config.md
index a8c6232c43..ad5c3ca361 100644
--- a/docs/api-site-config.md
+++ b/docs/api-site-config.md
@@ -123,6 +123,8 @@ h1 {
`gaTrackingId` - Google Analytics tracking ID to track page views.
+`gaGtag` - Set this to `true` if you want to use [global site tags (gtag.js)](https://developers.google.com/gtagjs/) for Google analytics instead of `analytics.js`.
+
`highlight` - [Syntax highlighting](api-doc-markdown.md) options:
- `theme` is the name of the theme used by Highlight.js when highlighting code. You can find the [list of supported themes here](https://github.com/isagalaev/highlight.js/tree/master/src/styles).
diff --git a/lib/core/Head.js b/lib/core/Head.js
index f25a0273e7..56e07266b9 100644
--- a/lib/core/Head.js
+++ b/lib/core/Head.js
@@ -95,6 +95,44 @@ class Head extends React.Component {
title={this.props.config.title + ' Blog RSS Feed'}
/>
)}
+ {this.props.config.gaTrackingId &&
+ this.props.config.gaGtag && (
+
+ )}
+ {this.props.config.gaTrackingId &&
+ this.props.config.gaGtag && (
+
+ )}
+ {this.props.config.gaTrackingId &&
+ !this.props.config.gaGtag && (
+
+ )}
{/* External resources */}
{this.props.config.stylesheets &&
diff --git a/lib/core/Site.js b/lib/core/Site.js
index e1f4651ec7..9c151f4f09 100644
--- a/lib/core/Site.js
+++ b/lib/core/Site.js
@@ -83,21 +83,6 @@ class Site extends React.Component {
src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"
/>
)}
- {this.props.config.gaTrackingId && (
-
- )}
{this.props.config.facebookAppId && (