Skip to content

Commit

Permalink
Use new Google Analytics template to accommodate both GA4 and GS3 in …
Browse files Browse the repository at this point in the history
…header (#341)
  • Loading branch information
linhtto authored Sep 6, 2022
1 parent 591eb5a commit e7e8344
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions layouts/404.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{ partial "head/metadata.html" . }}

{{ define "title" }}
<h1 class="bold-title is-1">{{ i18n "404_title" . }}</h1>
{{ end }}
Expand Down
2 changes: 0 additions & 2 deletions layouts/partials/footer/scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
3 changes: 3 additions & 0 deletions layouts/partials/head/metadata.html
Original file line number Diff line number Diff line change
@@ -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">
Expand Down

0 comments on commit e7e8344

Please sign in to comment.