Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use new Google Analytics template to accommodate both GA4 and GS3 #341

Merged
merged 1 commit into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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