Developer Announcements

HubSpot Employee
HubSpot Employee

Deprecating `previousCategories` in the Cookie Banner API

The original Developer Changelog announcement . The article content is copied from that post below for convenience. If you have questions or comments you can leave them below.

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.

  allowed: true or false,
  categories: {
    necessary: true,
    analytics: true or false,
    advertisement: true or false,
    functionality: true or false,
  previousCategories: {
    necessary: true,
    analytics: true or false, # defaults to false
    advertisement: true or false, # defaults to false 
    functionality: true or false, # defaults to false

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.

Jon McLaren

Sr. CMS Developer Advocate

Get started developing on the HubSpot CMS Developer Changelog
How to optimize your CMS Hub site for speed

If my reply answered your question, please mark it as a solution, to make it easier for others to find.

0 Respuestas 0

0 Respuestas

Aún no hay respuestas para esta publicación.

Por ahora, ningún usuario ha respondido a esta publicación. Vuelve pronto para ver si alguien tiene la solución o envía tu propia respuesta si sabes cómo ayudar. Cada grano de arena cuenta.

Responder esta publicación

¿Necesitas ayuda para responder? Echa un vistazo a las pautas de la comunidad