-
Notifications
You must be signed in to change notification settings - Fork 614
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
Fix google analytics feature #989
Conversation
✅ Deploy Preview for toha-ci ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @joyao ! Thank you for the PR. Look like we are breaking compatibility here. With this change, following configuration will not work anymore:
services:
googleAnalytics:
ID: G-MEASUREMENT_ID
Do we want to force user to use analytics configuration from site.Params.analytics.services.google.id
? In that case, we should also provide a way do specify respectDoNotTrack
under site.Params.analytics.services.google
section.
I think both methods should be supported. I’ll fix it and thanks for your suggestion. |
Hi @hossainemruz, under the "{{ with .google }}" condition, my original changes support both project custom settings and original settings as following, and have been tested. analytics:
enabled: true
services:
# Google Analytics
google:
id: G-H4LBG7NDFZ
respectDoNotTrack: false services:
googleAnalytics:
ID: G-H4LBG7NDFZ
privacy:
googleAnalytics:
disable: false
respectDoNotTrack: true So I just add the "respectDoNotTrack" part. |
So what's the current workaround for getting analytics working, manually having these two files within layouts? |
Hi @jamesdeluk, this PR hasn't been merged yet. If you want to have this fixed feature, you can merge my branch or fix these two files manually in your project. |
Thanks. And which is the best |
This one: analytics:
enabled: true
services:
# Google Analytics
google:
id: G-H4LBG7NDFZ
respectDoNotTrack: false You don't need to make many changes to this, this section is already in the current hugo.yaml file. You just need to change the id. |
Great, thanks! And I guess |
Yes, it should work. :) |
Hi @hossainemruz, I believe it works as expected. Please take your time reviewing it. Thank you. |
Sorry for taking this long. I had plan to merge it this weekend but couldn't make it. I will definitely make sure to merge within next weekend. |
Issue
Fixes #955
Description
Fix google analytics feature based on official document.
https://gohugo.io/templates/embedded/#google-analytics
Test Evidence