Overview
Integrate the Salesforce Interactions SDK
Integrate Salesforce Personalization with Modern Frontend Frameworks
Request Personalization Through the Sitemap
Example Sitemap
Track Personalization Engagement
To power Personalization’s advanced machine learning, it’s essential to capture and analyze how users interact with your site, especially with personalized content. This continuous data collection helps Personalization better understand user behavior, allowing the system to deliver recommendations that become more accurate and hyper-personalized over time.
User interaction event logs are automatically sent from the Web SDK sitemap to Data Cloud for tracking. This data is crucial for powering machine learning algorithms and for reporting and analytics within Data Cloud. The Data Cloud module processes these structured events by flattening them, assigning an eventType for categorization, and organizing them into data streams. You can even merge multiple event types into a single data stream.
To ensure events are categorized correctly, you must update your Data Cloud Web Schema. The schema defines the structure for event types, including their available fields, required fields, and field names. For more information on the structure of the Data Cloud Web Schema, see Mobile and Web SDK Schema Quick Guide for Data Cloud.
An Engagement Destination is a configuration that determines how user interaction events are processed, categorized, and sent to Data Cloud for analysis. When you configure a personalization experience in the Web Personalization Manager, you can choose a standard, out-of-the-box (OOTB) destination or create a custom one to fit your needs.
For more information on configuring a personalization experience and setting an engagement destination, see Creating a Personalization Experience.
Personalization provides two OOTB destinations for common use cases: Product Engagement and Website Engagement. These destinations use predefined event types to map engagement data to the correct Data Model Objects (DMOs).
| Engagement Destination | Associated Event Type | Recommended DMO |
|---|---|---|
| Product Engagement | catalog | Product Browse Engagement |
| Website Engagement | userEngagement | Website Engagement |
catalog event type.catalog-object-view-start for views and catalog-object-click for clicks.id field, that contains the unique identifier of the recommended item from your catalog, and a type field, which has a static value of Product.Here’s an example payload for a Product Engagement sent to Data Cloud.
1{
2 "id": "a00Ws000004x7vcIAA",
3 "eventType": "catalog",
4 "type": "Product",
5 "interactionName": "catalog-object-click",
6 "personalizationId": "2ad68afc-92d3-42f8-88df-d4310f...",
7 "personalizationContentId": "2ad68afc-92d3-42f8-88df...",
8 "eventId": "14d5d33c-85d6-4ecf-b207-8972f585dcae",
9 "dateTime": "2025-08-11T11:54:46.439Z",
10 "sessionId": "9fecd3474b94558b",
11 "deviceId": "9fecd3474b94558b"
12}userEngagement event type.personalization-view for views and personalization-click for clicks.id or type field.Here’s an example payload for a Website Engagement sent to Data Cloud.
1{
2 "eventType": "userEngagement",
3 "eventId": "dcd02e31-8fc4-4b40-918...",
4 "dateTime": "2025-05-27T11:56:01.057Z",
5 "sessionId": "583f6a8907a88c75",
6 "deviceId": "583f6a8907a88c75",
7 "interactionName": "Button Clicked",
8 "sourceUrl": "https://zzpq-01........",
9 "sourceUrlReferrer": "https://zzpq-...",
10 "sourceChannel": "Web",
11 "sourcePageType": "Default",
12 "category": "Engagement"
13}While OOTB destinations cover standard scenarios, you may require more control to handle unique tracking requirements or to modify event data. Custom engagement destinations give you granular control over how engagement events are categorized before they’re sent to Data Cloud.
To create a custom destination, you add code to your sitemap in a two-step process:
First, retrieve the live engagement configuration from the SDK using the SalesforceInteractions.Personalization.Config.Engagement.get function.
This function fetches the current configuration object and stores it in a variable, currentEngagementConfig, making it available for modification.
Once you’ve retrieved the configuration object, you can define and add your new destination to its destination property. These parameters make up the engagement destination.
labelA user-friendly name for the destination that appears in the Web Personalization Manager UI.
descriptionA brief explanation of what this destination is used for. You can also use the label as your description.
disableSendingNonItemEngagementEventsA boolean that, if set to true, denotes that the personalization experience involves recommendations (such as product or article recommendations). If set to false, it denotes manual content being recommended.
eventModifiersAn object containing properties that will override the default values in the engagement event payload. The eventModifiers object accepts these parameters.
typeThe type of the item being recommended. This is valid only for personalization experiences based on product recommendations.
event-typeThe Data Cloud event type that needs to be mapped to the appropriate DMOs. Ensure that the event type is defined in the Data Cloud web schema and mapped to the correct DMOs.
interaction-nameSpecifies the type of interaction that occurred, such as a view or a click. You can also define this as a function where it receives a single context parameter. This context object contains a name property with a string value of either view or click, depending on the user's action. You can use this context.name value within your function to return custom interaction names.
1'interaction-name': (context) => {
2 switch (context.name) {
3 case 'view':
4 return 'my-custom-VIEW-interaction-name';
5 case 'click':
6 return 'my-custom-CLICK-interaction-name';
7 default:
8 return undefined;
9 }
10}Here’s a complete example of retrieving the existing configuration, adding a new destination, and applying it during the SDK initialization.
1// Add a new destination to the current configuration
2const currentEngagementConfig = SalesforceInteractions.Personalization.Config.Engagement.get();
3currentEngagementConfig.destinations['popupEngagement'] = {
4 label: 'Popup Engagement',
5 description: 'Popup Engagement',
6 disableSendingNonItemEngagementEvents: false,
7 eventModifiers: {
8 'type': 'Product',
9 'event-type': 'userEngagement',
10 'interaction-name': (context) => {
11 switch (context.name) {
12 case 'view':
13 return 'my-custom-VIEW-interaction-name'
14 case 'click':
15 return 'my-custom-CLICK-interaction-name'
16 default:
17 return undefined
18 }
19 }
20 }
21};
22// Apply the updated configuration during SDK initialization
23SalesforceInteractions.Personalization.Config.initialize({
24 ...
25 /* Add the custom Engagement Destination */
26 customEngagementConfig: currentEngagementConfig
27 ...
28});While many out-of-the-box templates handle engagement tracking automatically, you may need to manually send engagement events for custom-built experiences. For this alternative path, use the standard SalesforceInteractions.sendEvent function of the Interactions SDK to send engagement events.
For accurate tracking, add the personalizationId and personalizationContentId values from the personalization response to every engagement event you send manually.
1SalesforceInteractions.sendEvent({
2 interaction: {
3 name: "personalization-click",
4 eventType: "userEngagement",
5 catalogObjectType: "<type of catalog object, for example "Product" or "Category">",
6 catalogObjectId: "<catalogObjectId from the personalization response JSON, as applicable>",
7 personalization: {
8 id: "<personalizationId from the personalization response JSON>",
9 contentId: "<personalizationContentId from the personalization response JSON, for a specific product>",
10 },
11 },
12});Always set id and contentId. For a specific product, set contentId to the personalizationContentId value from the JSON response. Otherwise, set it to the personalizationId.
Note