a-digital / cookie-consent-banner

Add a configurable cookie consent banner to the website.
MIT License
11 stars 13 forks source link

Prevent from showing for specific templates #2

Closed arifje closed 6 years ago

arifje commented 6 years ago

I would like to prevent the banner from popping up on certain templates. Can't find any way to accomplish this.

Thanks!

mark-adigital commented 6 years ago

Hey,

To be honest, I'll have to look into the best way to implement this but at first glance I'm more inclined to add a new setting and then perform the check based on entry types rather than templates.

Will let you know when I have some time to look at it.

Mark

arifje commented 6 years ago

Hi Mark,

Maybe it's an idea to create a little tag that generates the popup, instead doing to behind the scenes? This way I can add it to my header and skip if for specific URL segments/pages.

Cheers

mark-adigital commented 6 years ago

Thanks for the suggestion, but to be honest I'm not sure I'd favour that approach as it introduces a breaking change for anyone else already using the plugin, and I think part of the utility of it is that it's just 'plug and play' with fairly minimal setup in the CP. Choosing entry types to exclude is effectively based on templates in most setups, keeps everything centralised in the plugin settings and means it's just a case of selecting the types where the banner shouldn't appear rather than going through and adding the code to each template where it should display, which most of the time is probably going to be the vast majority.

arifje commented 6 years ago

Hi,

Cookies indeed perists across templates, but not if you're using a template in a mobile webview. This is now the issue for us; the modal is shown in our app on iOS/Android, and they will keep popping up because most webviews won't accept cookies (such as Facebook in-app webviews). This is where we would like to prevent the plugin generating the modal.

For example: there are lot of websites that also send users from their Facebook page to their website. 50+ percent is on mobile nowadays. All these users will see this modal every time they visit the website via the Facebook app.

I really think it's better to give the developer the choice where to show the modal; automatic (which is now the case) or with the help of a tag (which we can add in the header template).

mark-adigital commented 6 years ago

Ok, I've added new settings to the plugin so you can choose to exclude the banner from certain entry types or categories and this is available with the most recent release (I had actually already started working on this before the previous comments).

As explained previously, I favour this approach over adding a template tag because that would break the current functionality for everyone else. I appreciate it might not resolve your issue with in-app views, but I was obviously unaware of that specific issue until your most recent comment.

arifje commented 6 years ago

Awesome!

mark-adigital commented 6 years ago

Great!

john-henry commented 5 years ago

Hi @mark-adigital any suggestions how you might exclude this from say an RSS feed template or even error templates etc?

mark-adigital commented 5 years ago

Hi @john-henry - I've added a couple of checks before the banner is included for the content type and status code. Seems to be working as expected for me, so I've added a new pre-release version 1.1.3-beta.1, are you able to test that on your end? Thanks

john-henry commented 5 years ago

Hi @mark-adigital Ill give this a test but I don't know if it will suit what I want to do.

an RSS template I manually create or say an amp template I manually create. Or even the login page for Craft. I don't want the Cookie Consent banner appearing on those pages. None of them are Entry types or Categories. How would I exclude them from the a banner showing.

I suppose its an enhancement request really. Maybe like a Matrix type field in the plugins settings that you could add urls or regex to exclude them.

john-henry commented 5 years ago

@mark-adigital Seems to be ok this end thanks

mark-adigital commented 5 years ago

@john-henry Great - I've fully released this update now

PaulCWoods commented 5 years ago

Hi. Yes it would be great to exclude templates as well. It's appearing in AMP pages on my site which breaks the validation.