Deprecating previousCategories in the Cookie Banner API
We've discovered that in some situations the
previousCategories field within the cookie banner's consent object has incorrect values. The Cookie Banner API provides consent listeners so that developers can properly handle cookies based on the user's consent, represented by the consent object. The
previousCategories field was intended to store the previous state of the user's consent preferences. This was used so that if a user submitted preferences to the cookie banner, but later re-opened the cookie banner within the same page visit and changed preferences, then a developer could properly handle the differences.
After further investigation, we've determined there is no way to properly support this field. To prevent confusion and simplify the experience, we will be deprecating the field on Monday, April 3rd.
On Monday, April 3rd we'll be releasing an update to
previousCategories which will always imply consent has changed. This should ensure that event listeners will always react the same way to negative consent, fix issues where
previousCategories contained incorrect values.
For the majority of sites, we expect no issues and it is more likely that this will actually fix bugs in consent listeners ensuring the user's change in consent is properly respected.
If you've written custom code for handling this change in users consent, you may want to review it just to ensure that if a change from the previous state is always implied - your code will continue to operate how you expect. As noted previously, in most situations, this should fix issues rather than create new ones.
Questions or comments? Join us in the developer forums.