M _config.yml => _config.yml +1 -1
@@ 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 :
A _includes/analytics-providers/google-gtag.html => _includes/analytics-providers/google-gtag.html +9 -0
@@ 0,0 1,9 @@
+<!-- Global site tag (gtag.js) - Google Analytics -->
+<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.analytics.google.tracking_id }}"></script>
+<script>
+ window.dataLayer = window.dataLayer || [];
+ function gtag(){dataLayer.push(arguments);}
+ gtag('js', new Date());
+
+ gtag('config', '{{ site.analytics.google.tracking_id }}');
+</script>
M _includes/analytics.html => _includes/analytics.html +2 -0
@@ 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 %}