{{- if .Site.IsServer -}}
<!-- only production, not generate Google Analytics with Hugo’s built-in server -->
{{- else -}}
{{- with .Site.Params.google_analytics_id -}}
<!-- BEGIN: Google Analytics -->
<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: Google Analytics -->
{{- end -}}
{{- end -}}
