Personalization events

Changed data events

The Send2CRM client raises events when Goals, Segments and general personalization data are changed via client or service automation. The events are:

  • send2crmDataChanged

  • send2crmGoalsChanged

  • send2crmSegmentsChanged

Each event is raised on the window object, and includes the previous and current data in event.detail.old and event.detail.new respectively.

These events are triggered when changes are made. For tasks that need to run on every page standard events such as load can be used. The Send2CRM visitor information can be tested at any time.

window.addEventListener('send2crmDataChanged', (event) => { // Object with previous values. console.log('Old data', event.detail.old); // Object with current values. console.log('New data', event.detail.new); });

Identified event

This event is raised when visitor identification changes, for example when a visitor submits a form that results in a change from anonymous to identified.

The event name is send2crmIdentified and is raised on the window object. The event.detail property is set to the visitor object itself.