mirror of
https://github.com/TeamPiped/hugo-whisper-theme.git
synced 2024-08-14 23:57:00 +00:00
first commit
This commit is contained in:
commit
dcdde20b7c
179 changed files with 16070 additions and 0 deletions
26
layouts/partials/google-analytics.html
Normal file
26
layouts/partials/google-analytics.html
Normal file
|
@ -0,0 +1,26 @@
|
|||
{{- if .Site.IsServer -}}
|
||||
<!-- Dont add Google analytics to localhost -->
|
||||
{{ else }}
|
||||
{{ $gid := (getenv "HUGO_GOOGLE_ANALYTICS_ID") }}
|
||||
{{ if $gid }}
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{- $gid -}}"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
gtag('config', '{{- $gid -}}');
|
||||
</script>
|
||||
{{ else }}
|
||||
{{ if .Site.Params.google_analytics_id }}
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{- .Site.Params.google_analytics_id -}}"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
gtag('config', '{{- .Site.Params.google_analytics_id -}}');
|
||||
</script>
|
||||
{{ end }}
|
||||
{{ end}}
|
||||
{{ end }}
|
Loading…
Add table
Add a link
Reference in a new issue