Identified Visitor data
The S4S Cloud 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.
...
Code Block | ||
---|---|---|
| ||
// Apply the Personalization facet 'IS_CONTACTED' when the Visitor has a recorded phone call. S4SCloudsend2crm.personalization.setFacetWhen('IS_CONTACTED', function(visitor) { return Boolean(visitor.data.callDate); }); |
...
Code Block |
---|
window.addEventListener('load', (evt) => { // Display a welcome back message on page load. let visitorName = S4SCloudsend2crm.analytics?.visitor.data.firstName; if (visitorName) { alert('Welcome back, ' + visitorName + '!'); } }); |
...
Custom personalization data can be set for the current visitor by calling the S4S Cloud send2crm library function:
Code Block | ||
---|---|---|
| ||
S4SCloudsend2crm.personalization.setData('firstName', 'John'); |
Listen for changes
Subscribe to the S4SCloudDataChanged
send2crmDataChanged
event to be notified when S4S Cloud send2crm personalization data changes.
...