Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

Identified Visitor data

The send2crm service allows configuring custom values for personalization. These are returned with the response each time the visitor update is sent. For example, the Salesforce package may map Lead or Contact field values.

These custom values are stored in the data property of the Visitor object.

The Visitor can access any personalization values using their browser inspector. Do not map sensitive information that you don’t want the visitor to see.

All of the functionality below works for any visitor, but for an Anonymous Visitor you will only have access to the website data set.

Set Facets from Personalized Data

You can use visitor data to determine when Facets should be applied.

// Apply the Personalization facet 'IS_CONTACTED' when the Visitor has a recorded phone call.
send2crm.personalization.setFacetWhen('IS_CONTACTED', function(visitor) {
  return Boolean(visitor.data.callDate);
});

Access Personalized Data Directly

window.addEventListener('load', (evt) => {
	// Display a welcome back message on page load.
	let visitorName = send2crm.analytics?.visitor.data.firstName;
	if (visitorName) {
		alert('Welcome back, ' + visitorName + '!');
	}
});

Custom data

Custom personalization data can be set for the current visitor by calling the send2crm library function:

send2crm.personalization.setData('firstName', 'John');

Listen for changes

Subscribe to the send2crmDataChanged event to be notified when send2crm personalization data changes.

See Personalization Events for more details.

  • No labels