dutchheight / craft-cookie-boss

Allow your visitors to set their cookie preference.
Other
3 stars 1 forks source link

example for actual use and deactivation with google analytics? #8

Closed ballmannweber closed 4 years ago

ballmannweber commented 4 years ago

I'm currently testing the cookie boss plugin and we wonder how it actually functions in the code layer? we got all the frontend parts but how can we get it to deactivate the google analytics cookie for instance?

we find the conditional {% if craft.cookieBoss.isConsentWith('marketing') %} in the readme which we use to bracket the actual google analytics code that we have in the html head.

is this the right thing to do?

thanks!

KevinBeckers commented 4 years ago

Yes, you are right. You can place the Google analytics code in the {% if craft.cookieBoss.isConsentWith('marketing') %} so it will only be used when these cookies are consent. For now, this is the only option. We plan to add JS events so you can trigger custom JS functions and create some activate/deactivate logic yourself.

ballmannweber commented 4 years ago

thanks for the quick feedback! I tested all cookie plugins for craft as well as some open source tools (3rd party hosted and localhosted) but I must say cookie boss seems to be the best solution. for future releases if would be great to have a middle/middle option for placing the modal as well as making it more obvious that the options underneath the necessary cookies are clickable.

KevinBeckers commented 4 years ago

Thank you, good to hear. That is a use-full suggestion. We plan to add more default modal types. For the time being, you can add a custom modal.

ballmannweber commented 4 years ago

yes, I tried that but I'm getting server errors maybe because I don't handle the tag right. another great addition would be support for different languages. our craft site uses german/english for instance and I noticed that some other cookie plugins support those native languages.

KevinBeckers commented 4 years ago

Let me know if you need help with the modal, happy to help.

The plugin should support different languages as far as I know. Currently, there is only a Dutch translation tho. Maybe you can provide a German translation, this would be much appreciated! Also if you miss any translation handles please let me know.

ballmannweber commented 4 years ago

do you have one complete example code for the custom modal? I still don't get it how it should be coded…

in some other cookie plugins there will automatically show german/english pulldowns like in the entries as soon as there is a second language option created. do you know what I mean?

and, is there an option right now to place the modal center/center in the viewport or do I have to hack it via css?

ballmannweber commented 4 years ago

oh, and another question: is there a way to diable the default css?

KevinBeckers commented 4 years ago

do you have one complete example code for the custom modal? I still don't get it how it should be coded…

You can, using the available twig handles. See the default modal how I implemented these handles to create the modal. So you can create modals with your own HTML/CSS. The current modal is just a fancy way of displaying the plugins features.

in some other cookie plugins there will automatically show german/english pulldowns like in the entries as soon as there is a second language option created. do you know what I mean?

I understand, this kind of multisite support is on the roadmap. I need this myself as well. This will also make different configurations per site possible.

and, is there an option right now to place the modal center/center in the viewport or do I have to hack it via css?

As I said, currently this is only available with custom modals. At the moment I don't have the time to create a new center/center orientated model. So what I could do in the mean time, is implement center/center positioning on the current model. With that being said, the current model (design) isn't realy meant to be center/center. But if this would help you, I am willing to implement this for the time being.

ballmannweber commented 4 years ago

Hi Kevin, thank you for your detailed answer!

The most pressing thing would actually be to be able to place the modal in the middle/center, because the website in question has a layout where there are inappropriate places at the top, bottom, left or right. I have tried to do it using CSS, but I can only do that if the modal has full viewport height, which I don't want, of course.

So if you could modify it accordingly, I would be very grateful! Thank you very much!

KevinBeckers commented 4 years ago

@ballmannweber their should be a position option in v1.3.0. I just pushed the changes.

ballmannweber commented 4 years ago

@KevinBeckers thank you very much for this quick addition of the center-styles! it works like a charm!

KevinBeckers commented 4 years ago

@ballmannweber, no problem! Let me know if you have issues.