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