theNewDynamic / gohugo-theme-ananke

Ananke: A theme for Hugo Sites
https://ananke-theme.netlify.app
MIT License
1.18k stars 1.18k forks source link

Cookie Consent Dialog #501

Open larihuttunen opened 2 years ago

larihuttunen commented 2 years ago

As many sites use Google analytics to track their usage, having a cookie acceptance dialog is becoming a must have. Would it be possible to have this kind of a feature in Ananke?

For example the zen-theme does have this functionality, but it think for a Blog Ananke is a better fit. Please see this post for reference.

regisphilibert commented 2 years ago

@larihuttunen that is an interesting suggestion.

The shared implementation adds a cookie with the information on the user consent. Then it's up to the developer to make sure any given services is disabled/enabled based on that cookie's value.

In itself it's not a toggle on/off service that ensures your site is compliant with local regulations.

It still has value as we would have a consent banner appropriately themed with the consent cookie storing logic built-in.

But even then, I think many regulations impose more options than simply "Accept" or "Decline". So that "Ananke" consent banner could prove insufficient in several cases.

Knowing all that, do you still think that feature would be of benefit to you? I'm asking because I don't think it would be interesting to most of the theme's users which are not necessarily technical users and as such would probably not be able to take care of the rest of the work: what happens after the cookie is stored/read.

cc @budparr

larihuttunen commented 2 years ago

@regisphilibert I agree, the work needed to deploy tracking for all cookies beside Google Analytics or Matomo turned out to be bit more than I originally anticipated. How I ended up solving the problem, was deploying a commercial solution, cookiebot, via Google Tag Manager. That is an elegant solution and easy to deploy if you're using GTM.

On that note, would it be possible to have a Google Tag Manager support in Ananke?

Currently, there is the Google Analytics support in layouts/_default/baseof.html, but in reality nowadays it is easier to use GTM to deploy Analytics and all the needed components, such as Cookiebot to trigger as needed.

budparr commented 2 years ago

We have the head-additions partial specifically for drop-ins like GTM. Isn't it the case that Google typically provides you with the entire tag to drop in?

larihuttunen commented 2 years ago

@budparr that is correct and I had figured that much. It might actually be a good idea to document that in the README?

budparr commented 2 years ago

You think something more than this is needed? https://github.com/theNewDynamic/gohugo-theme-ananke#adding-scripts-to-the-page-head

Adding Scripts to the Page Head

Some scripts need to be added within the page head. To add your own scripts to the page head, simply insert them into the head-additions.html partial located in the layouts/partials folder.

larihuttunen commented 2 years ago

I think an example might be good, to make it concrete. For example, to say that this would be the mechanism to deploy GTM.