Track3 / hermit

A minimal & fast Hugo theme for bloggers
https://hugo-theme-hermit.netlify.com/
MIT License
1.11k stars 305 forks source link

Google Analytics doesn't Track Any Traffic. #127

Closed Jarmos-san closed 3 years ago

Jarmos-san commented 4 years ago

As specified in the documentation I updated the config variable with my Google Analytics Tracking ID, yet it doesn't seem to be tracking any traffic.

As an added precaution I even added an analytics.html file in the root layout/partials folder. Nothing seems to work.

So where am I going wrong?

santosh commented 4 years ago

I noticed Google Analytics takes some time to reflect the data. can you confirm if this is working for you now?

Jarmos-san commented 4 years ago

@santosh I scraped the project after tinkering around with for a while. So apologies but I can't confirm it for you anymore.

If necessary I can close the issue right away though.

santosh commented 4 years ago

For me, the analytics work fine.

In this case, closing the issue would be good in my opinion, what do you say @Track3?

Jarmos-san commented 4 years ago

Alright, great! I personally prefer closing down stale issues. If someone else faces the same they can reopen the issue as required.

moorara commented 4 years ago

Google analytics has not been receiving any traffic from my Hugo/Hermit site recently. I guess this happened after I update hermit git submodule in my site repo.

Jarmos-san commented 4 years ago

Google analytics has not been receiving any traffic from my Hugo/Hermit site recently. I guess this happened after I update hermit git submodule in my site repo.

If it's still prevalent, I'm willing to reopen the issue.

moorara commented 4 years ago

@Jarmos-san yes please. can you reopen this again? I have checked my GA tracking id, Hermit analytics.html partial and baseof.html and they look fine to me. Yet, in my compiled static site, I can't find a reference to Google Analytics.

shibumi commented 3 years ago

@Jarmos-san I am very confident the reason for this misbehavior is that you use a google analytics v4 ID: https://gohugo.io/templates/internal/#use-the-google-analytics-template

If so, hermit includes the wrong template. We have to use: {{ template "_internal/google_analytics.html" . }}

EDIT: Okay, you also have to disable the privacy configuration in the config.toml file. On default all of them are disabled for GDPR compliance:

# Disable all services for GDPR compliance
[privacy]
[privacy.disqus]
disable = true
[privacy.googleAnalytics]
disable = true
[privacy.instagram]
disable = true
[privacy.twitter]
disable = true
[privacy.vimeo]
disable = true
[privacy.youtube]
disable = true

Note: If you live in Europe I would suggest to keep it disabled, because hugo nor hermit seem to support a "cookie dialog" for asking the user for permission... sigh..

Jarmos-san commented 3 years ago

@shibumi thanks for the heads up! Yeah I figured out the issue quite some time ago & forgot to respond back to this issue. So, I think your suggestions are pretty valid & I can close this issue.

Cheers & thanks!