segmentio / consent-manager

Drop-in consent management plugin for analytics.js
https://segmentio.github.io/consent-manager/
MIT License
341 stars 142 forks source link

`acceptAll` method in `bannerActionsBlock` overridden by `initialPreferences` settings #345

Open jerturowetz opened 1 year ago

jerturowetz commented 1 year ago

When I set initialPreferences to false for all categories, the bannerActionsBlock method for acceptAll doesn't work as anticipated. I expect the tracking prefs cookie to get set to true for all destinations. Instead, I find the cookie sets all the destinations to false, (which is the the state of the prefs dialogue checkboxes).

Popping open the preferences dialogue using changePreferences pressing save doesn't set the cookie at all unless i toggle the options on and then off again. It's like the cookie being set is looking for a state change but isn't considering the settings applied by initialPreferences.

When I do the opposite, setting all categories in initialPreferences to true and fire the denyAll method, the results are expected. The cookies for all destinations (which were originally true) get set to false and the page refreshes.

initialPreferences and acceptAll Bug with Segment Consent Manager (1 of 2) - Watch Video

initialPreferences and acceptAll Bug with Segment Consent Manager (2 of 2) - Watch Video

edsonjab commented 1 year ago

Hi @jerturowetz thank you for your report, we start looking into this

edsonjab commented 1 year ago

Hi @jerturowetz I identify that you still use a 5.3.0 version, so, update your library version to last will help you to has a better performance of the app.

jerturowetz commented 1 year ago

@edsonjab I'm using 5.8.1 and the issue persists. The "Accept All" button does not function, it merely saves whatever settings are set in the radio buttons (as defined by initialPreferences).

Eg: if initialPreferences are set to be:

{
  functional: false,
  marketingAndAnalytics: true,
  advertising: false,
} 

The Accept All button sets all functional destinations to false, all marketingAndAnalytics destinations to true and all advertising destinations to false

edsonjab commented 1 year ago

Yes, you are right, but with my PR #347 that will be fix.

jerturowetz commented 1 year ago

Isn't the issue be that in the acceptAll method checks if any properties are set instead of overriding? From a user perspective, AcceptAll and DenyAll would apply global settings regardless of which radio button is clicked in the prefs dialogue.