Use new Google Analytics template to accommodate both GA4 and GS3 in header (#341)

This commit is contained in:
Linh T. Tô 2022-09-05 20:13:27 -04:00 committed by GitHub
parent 591eb5ab07
commit e7e8344a51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 3 deletions

View file

@ -189,7 +189,7 @@ You can easily use Plausible.io for analytics by setting `plausible = true` in y
## Google Analytics
Set `googleAnalytics` in `config.toml` to activate Hugo's [internal Google Analytics template](https://gohugo.io/templates/internal/#google-analytics).
Set `googleAnalytics` in `config.toml` to activate Hugo's [internal Google Analytics template](https://gohugo.io/templates/internal/#google-analytics). This supports both Google Analytics 3 (Universal Analytics) and Google Analytics 4. Google Analytics 3 tracking id is of the form 'UA-PROPERTY_ID', and Google Analytics 4 tracking is of the form 'G-MEASUREMENT_ID'.
## Disqus

View file

@ -1,3 +1,5 @@
{{ partial "head/metadata.html" . }}
{{ define "title" }}
<h1 class="bold-title is-1">{{ i18n "404_title" . }}</h1>
{{ end }}

View file

@ -3,8 +3,6 @@
{{ $scripts := slice $jQuery $index | resources.Concat "js/bundle.js" | fingerprint }}
<script src="{{ $scripts.Permalink }}" integrity="{{ $scripts.Data.Integrity }}"></script>
{{ template "_internal/google_analytics_async.html" . }}
<!-- Custom JavaScript -->
{{ range .Site.Params.customJS -}}
{{ $script := resources.Get . | minify }}

View file

@ -1,3 +1,6 @@
{{ template "_internal/google_analytics.html" . }}
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="HandheldFriendly" content="True">