From 83e3a4e8e16d395b929e89b449e10f208de3e0a3 Mon Sep 17 00:00:00 2001
From: Julian Alarcon <alarconj@gmail.com>
Date: Thu, 11 Feb 2021 12:56:39 -0500
Subject: [PATCH] feat: Google Analytics support (#135)

* Added Google Analytics feature

* style: load GA script before head/custom

* style(config): googleAnalytics field empty by default

Co-authored-by: Jimmy Cai <github@jimmycai.com>
---
 exampleSite/config.yaml         | 3 +++
 layouts/partials/head/head.html | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml
index 515c97c..438984a 100644
--- a/exampleSite/config.yaml
+++ b/exampleSite/config.yaml
@@ -7,6 +7,9 @@ title: Example Site
 # Change it to your Disqus shortname before using
 disqusShortname: hugo-theme-stack
 
+# GA Tracking ID
+googleAnalytics:
+
 # Theme i18n support
 # Available values: en, fr, id, ja, ko, pt-br, zh-cn
 DefaultContentLanguage: en
diff --git a/layouts/partials/head/head.html b/layouts/partials/head/head.html
index de2982c..fd9ef73 100644
--- a/layouts/partials/head/head.html
+++ b/layouts/partials/head/head.html
@@ -21,4 +21,5 @@
     <link rel="shortcut icon" href="{{ . }}" />
 {{ end }}
 
-{{- partial "head/custom.html" . -}}
\ No newline at end of file
+{{- template "_internal/google_analytics_async.html" . -}}
+{{- partial "head/custom.html" . -}}