Skip to content

Add Support for Google Analytics V4 gtag#162

Merged
StefMa merged 1 commit intoStefMa:masterfrom
selkhateeb:master
Mar 14, 2023
Merged

Add Support for Google Analytics V4 gtag#162
StefMa merged 1 commit intoStefMa:masterfrom
selkhateeb:master

Conversation

@selkhateeb
Copy link
Contributor

According to Hugo's documentation (https://gohugo.io/templates/internal/#use-the-google-analytics-template)

This template is not suitable for Google Analytics 4 {{ template "_internal/google_analytics_async.html" . }}

So, this change uses the recommended template that supports both versions.

Copy link
Owner

@StefMa StefMa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch 👍
Thank you for the contribution.

Can you please change the go.mod file? Then I can merge it 🙂 Thank you!

go.mod Outdated
@@ -1,4 +1,4 @@
module github.com/StefMa/hugo-fresh
module github.com/selkhateeb/hugo-fresh
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be reverted 😇

Suggested change
module github.com/selkhateeb/hugo-fresh
module github.com/StefMa/hugo-fresh

@StefMa
Copy link
Owner

StefMa commented Mar 14, 2023

Maybe you can also adjust the exampleSite/hugo.yaml file comment for analytics to:

# Put in your tracking code without quotes like this: UA-XXX for universal tracking or G-XXX analytics v4 tracking

Would be nice I guess 🙃

According to Hugo's documentation (https://gohugo.io/templates/internal/#use-the-google-analytics-template)

This template is not suitable for Google Analytics 4
{{ template "_internal/google_analytics_async.html" . }}

So, this change uses the recommended template that supports
both versions.
@selkhateeb
Copy link
Contributor Author

Thanks @StefMa for your work on this and providing it. I've updated the branch and removed my testing nonsense. Also added the G-XXX comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants