Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
S4SCloud.personalization.setData('firstName', 'John');

Listen for changes

Subscribe to the S4SCloudDataChanged event to be notified when S4S Cloud personalization data changes.

Code Block
languagejs
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);
});