Accueil > Conseils > Day 8 : Salesforce, Experience Cloud, cookies and a cup of milk

Day 8 : Salesforce, Experience Cloud, cookies and a cup of milk

 2 min read


décembre 8, 2021


Hello everyone !

Today, I’m in charge of the 8th day of our Advent calendar and we are going to talk about cookies. This is a perfect timing to talk about those delicious biscuits that we can find in our daily use of Internet.

First step : Ingredients

  • A good cloud : This new winter 22 features are only available on Experience Cloud. For those who don’t know this cloud you can find an overview here.
  • A bit of API : This component requires API version 53.0 or later.
  • A pinch of LWC.


Second Step : The Cookies Recipe 

  1. First of all you have to enable cookie consent in Security & Privacy Settings, if you don’t, only the required types of cookies are allowed.
  2. Once the first step is done you can provide users the option to allow Marketing, Preference, and Statistics cookies as well.
  3. Next, go to your cookie consent LWC and import the user ConsentCookie module.
  4. Provide the user to consent all the cookie types you need (Required, Marketing, Preference, and Statistics) using the HTML file and JavaScript in your component.


Last Step : How to serve 

Furthermore, to continue with our cookies, here it’s the simplest way to use it in the Javascript part.

A table, not of chocolate but a String/Boolean one :

var consent = {
    "Preferences" : true, 
    "Marketing" : false 

Next, you must set it this way:


Finally, if you want to test which cookies are used :


If you want to see how HTML can be set up for this cookies consent component you can go to the documentation here.

Hope you enjoyed this blog post and don’t forget to read all the previous ones, starting with this one wrote by Fabien Huot presenting the new Assignment Expiration feature on Permissions sets.

Stay safe and enjoy Christmas !