Updated Analytics / Adsense code.

This commit is contained in:
Chris 2018-01-13 12:57:20 -05:00
parent be8ed2132a
commit 71a6e8a5b4

View file

@ -1,6 +1,5 @@
<!DOCTYPE html>
<html lang="{{ .Site.Params.languageCode | default " en-us " }}"
{{- if not .IsHome }}class="has-navbar-fixed-top"{{- end }}>
<html lang="{{ .Site.Params.languageCode | default " en-us " }}" {{- if not .IsHome }}class="has-navbar-fixed-top" {{- end }}>
<head>
<meta charset="utf-8">
@ -26,11 +25,7 @@
</head>
<body>
{{- if not .IsHome }}
{{ partial "layout/navbar" . }}
{{- end }}
{{ block "main" . }}{{ end }}
{{- if not .IsHome }} {{ partial "layout/navbar" . }} {{- end }} {{ block "main" . }}{{ end }}
<div class="container">
<footer class="footer">
@ -39,24 +34,25 @@
</div>
<script src="{{ .Site.BaseURL }}/js/script.js"></script>
{{ if eq (getenv "HUGO_ENV") "PRD" }}
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id={{ .Site.Params.GoogleAnalyticsTrackingId }} }}"></script>
<script type="text/javascript">
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '{{ .Site.Params.GoogleAnalyticsTrackingId }}', 'auto');
ga('send', 'pageview');
<script type="text/javascript">
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', '{{ .Site.Params.GoogleAnalyticsTrackingId }}');
</script>
<!-- End Google Analytics -->
{{- end }}
{{- block "scripts" . }}{{- end }}
</body>