[doc] Add analytics to rendered documentation
diff --git a/site/docs/config.toml b/site/docs/config.toml
index 5a83efb..264e665 100644
--- a/site/docs/config.toml
+++ b/site/docs/config.toml
@@ -55,6 +55,7 @@
pygmentsCodeFences = true
pygmentsStyle = "tango"
disableKinds = ["taxonomy", "taxonomyTerm", "RSS", "sitemap"]
+googleAnalytics = "UA-151030466-2"
[params]
generatedRoot = "build/docs-generated"
diff --git a/site/docs/layouts/partials/gtag.html b/site/docs/layouts/partials/gtag.html
new file mode 100644
index 0000000..6865da9
--- /dev/null
+++ b/site/docs/layouts/partials/gtag.html
@@ -0,0 +1,10 @@
+{{ with .Site.GoogleAnalytics }}
+<script async src="https://www.googletagmanager.com/gtag/js?id={{ . }}"></script>
+<script>
+ window.dataLayer = window.dataLayer || [];
+ function gtag(){dataLayer.push(arguments);}
+ gtag('js', new Date());
+
+ gtag('config', '{{ . }}');
+</script>
+{{ end }}
diff --git a/site/docs/layouts/partials/head.html b/site/docs/layouts/partials/head.html
index b5949c4..62decac 100644
--- a/site/docs/layouts/partials/head.html
+++ b/site/docs/layouts/partials/head.html
@@ -5,4 +5,5 @@
{{ $options := (dict "targetPath" "css/style.css" "outputStyle" "compressed" "enableSourceMap" true) }}
{{ $style := resources.Get "scss/style.scss" | resources.ToCSS $options }}
<link rel="stylesheet" href="{{ $style.Permalink }}">
+ {{ partial "gtag" . }}
</head>