Set a customer’s cookie preferences

To set cookie preferences, you provide an object containing key/value pairs. The key represents the cookie preference name, which must be an alphanumeric string. The corresponding value can be either true or false. True indicates the customer’s agreement to the use of a specific type of cookie, while false indicates disagreement. Any valid text string can be used as the cookie preference name. 

var userProfile = SC.Application.getComponent('UserProfile');
var cookieoption = {
 SAMPLE: true,
 DATA: true,
 LOGGEDIN: false
};


userProfile.setCookieOptions(cookieoption).then(function(response) {
 console.log('setCookieOptions was successful.');
}).catch(function(error) {
 console.log('setCookieOptions failed.');
 console.log(error);
});

Leave a comment

Your email address will not be published. Required fields are marked *