...
Code Block | ||
---|---|---|
| ||
S4SCloud.personalization.setData('firstName', 'John'); |
Listen for changes
Subscribe to the S4SCloudDataChanged
event to be notified when S4S Cloud personalization data changes.
Code Block | ||
---|---|---|
| ||
window.addEventListener('S4SCloudDataChanged', (event) => {
// Object with previous values.
console.log('Old data', event.detail.old);
// Object with current values.
console.log('Old data', event.detail.new);
}); |