Integrate the Salesforce Interactions SDK
To integrate the Salesforce Interactions SDK with your website and enable personalization capabilities, do the following.
- Create a data space
- Create a website connector
- Upload your event schema
- Install the Interactions SDK on your website
- Create and upload a sitemap
- Create a website data stream
- Map website connector object fields
You can connect Einstein Personalization to any data space, including the default data space that’s provided when you install Data Cloud. Until you create additional data spaces, all Data Cloud objects are mapped to the default data space.
To segregate your brand, region, or department data and services, create additional data spaces. To create more data spaces, you’ll need the Data Spaces add-on license.
To create a data space, do the following.
-
Go to Data Cloud Setup.
-
Under Data Management, click Data Spaces.
-
Click New, and give the data space a unique name.
-
Enter a unique data space prefix, starting with a letter and including up to three alphanumeric characters.
After you save the data space, you can’t change its prefix because it becomes part of the API name used to differentiate objects that exist in multiple data spaces.
-
Add an optional description about the purpose of the data space.
-
Click Save.
See Also
- Salesforce Help: Manage Data Spaces
- Salesforce Help: Create a Data Space
To capture website data and control the scope of data ingestion, connect your website to Data Cloud by creating a website connector.
- Go to Data Cloud Setup.
- Under CONFIGURATION, click Websites & Mobile Apps.
- Click New.
- Provide a Connector Name.
- From the Connector Type dropdown, select Website and click Save.
With Interactions SDK, you can track various types of interactions on your website, with each interaction capturing a specific set of data. When setting up a website connector to send this data to Data Cloud, you must upload a schema file in JSON format that outlines the structure of the event data you’re tracking.
The SDK provides a recommended schema file that covers common events such as adding items to a cart or viewing an item in a product catalog. This recommended schema includes mappings for:
- Engagement Events
- Cart Interaction Mapping
- Catalog Interaction Mapping
- Order Interaction Mapping
- Consent Event Mapping
- Profile Events
- Contact Point Email Mapping
- Contact Point Phone Mapping
- Identity Mapping
- Party Identification Mapping
To use the power of the unified event model, we suggest using the recommended schema. Alternatively, you can upload your own custom schema. Once uploaded, each interaction type appears as an object with corresponding attributes.
- Download the recommended schema file or use your own custom schema file.
- To upload the schema file, click Upload Schema under the Schema block.
- Confirm that all events and their associated fields are populated correctly.
- Click Save.
After you upload the schema, examine it for accuracy.
-
To change your schema at any point, click Update Schema.
You can only add new events and fields. The schema must retain all previous events and fields.
-
To update your schema, click Yes, Update.
-
To view the full schema you uploaded, click View Full Schema.
See Also
- Download: Recommended Web Connector Schema (JSON)
After you’ve created a connector for your website and configured your event schema, you can install the Interactions SDK on your website.
- Scroll down to the Integration Guide section at bottom of the website connector setup page.
- Copy the Content Delivery Network (CDN) URL.
- Add the script to the
<head>
section of your website’s code using a<script>
tag. - Initialize the SDK using the
SalesforceInteractions.init
method, as described in the Initialization section of the Salesforce Interactions SDK documentation.
See Also
The Web SDK sitemap is a JavaScript file that outlines the data capture logic across different pages of your website, based on which the SDK captures user interactions from your website during site navigation.
To create and upload a sitemap, do the following.
- Install the Salesforce Interactions SDK Launcher Chrome extension.
- Enable and access the Sitemap Editor on your website through the extension.
- Use the Sitemap Editor to instrument your website’s sitemap.
- Create a JavaScript file named
sitemap.js
. - Copy the sitemap code you created and paste it into this file.
- Navigate to the Sitemap section of the website connector setup page.
- Click Upload and upload the
sitemap.js
file you created. - Review the sitemap for errors, and click Save.
For more information on Interactions SDK sitemaps, see the Sitemap documentation.
Now that you’ve set up your website connector and installed and initialized the SDK on your website, you must create a new data stream for your website connector.
-
In Data Cloud, navigate to the Data Streams tab and click New.
-
Under Connected Sources, click Website and then click Next.
-
From the Website dropdown menu, select the website connector you configured.
-
Select the events that you’d like to capture from your website and click Next.
All engagement events are consolidated into one data stream with the category
Engagement
, while each profile event is individually categorized into its own data stream with the categoryProfile
. -
Review and verify the events you selected and their associated fields.
-
Click Next.
-
If you have more than one data space, select the data space you’d like to use with this data stream from the Data Space dropdown menu.
-
For every profile event you’re capturing, use the Refresh Mode dropdown to select the data refresh mode as either Incremental or Partial.
-
Click Deploy.
Data ingested by all data streams is written to data lake objects (DLOs). After creating your data streams, you must associate your DLOs to data model objects (DMOs).
To start data mapping, access the Data Stream detail page for your newly-created data stream and click Start Data Mapping. Doing so takes you to the field mapping canvas that displays your DLOs and target DMOs. To map one to another, click the name of a DLO and connect it to the desired DMO.
For your website data stream, you must map behavioral events and data as described in the following sections.
- Behavioral Events Data Mapping
Map fields in your website connector’s behavioral events DLO to the DMO.
- Contact Point Address Data Mapping
Ensure that no fields are mapped in your website connector’s contact point address DLO to the DMO.
- Contact Point Email Data Mapping
Map fields in your website connector’s contact point email DLO to the DMO.
- Contact Point Phone Data Mapping
Map fields in your website connector’s contact point phone DLO to the DMO.
- Identity Data Mapping
Map fields in your website connector’s identity DLO to the DMO.
- Party Identification Data Mapping
Map fields in your website connector’s party identification DLO to the DMO.
Map fields in your website connector’s behavioral events DLO to the DMO. Behavioral event data is divided into several subsections in the mapping canvas.
Section | DLO Field | Map to DMO | DMO Field |
---|---|---|---|
All Event Data | dateTime | Product Browse Engagement | Created Date |
Shopping Cart Engagement | Created Date | ||
All Event Data | deviceId | Product Browse Engagement | Individual |
Shopping Cart Engagement | Individual | ||
All Event Data | eventId (primary key) | Product Browse Engagement | Product Browse Engagement Id (primary key) |
Shopping Cart Engagement | Shopping Cart Engagement Id (primary key) | ||
cart | Not mapped | Not mapped | Not mapped |
cartItem | cartItem.catalogObjectId | Shopping Cart Engagement | Product |
cartItem | cateItem.catalogObjectType | Shopping Cart Engagement | Product Category |
cartItem | cartItem.currency | Shopping Cart Engagement | Currency |
cartItem | cartItem.price | Shopping Cart Engagement | Product Price |
cartItem | cartItem.quantity | Shopping Cart Engagement | Product Quantity |
cartItem | eventType | Shopping Cart Engagement | Engagement Type |
catalog | catalog.id | Product Browse Engagement | Product |
catalog | catalog.interactionName | Product Browse Engagement | Engagement Channel Action |
catalog | eventType | Product Browse Engagement | Engagement Type |
consentLog | Not mapped | Not mapped | Not mapped |
order | Not mapped | Not mapped | Not mapped |
orderItem | Not mapped | Not mapped | Not mapped |
Ensure that no fields are mapped in your website connector’s contact point address DLO to the DMO.
contactPointAddress DLO Field | Contact Point Address DMO Field |
---|---|
Not mapped |
Map the following fields in your website connector’s contact point email DLO to the DMO.
contactPointEmail DLO Field | Contact Point Email DMO Field |
---|---|
dateTime | Created Date |
deviceId (primary key) |
|
Email Address |
Map the following fields in your website connector’s contact point phone DLO to the DMO.
contactPointPhone DLO | Contact Point Phone DMO Field |
---|---|
dateTime | Created Date |
deviceId (primary key) |
|
phoneNumber | Telephone Number |
Map the following fields in your website connector’s identity DLO to the DMO.
identity DLO Field | Individual DMO Field |
---|---|
dateTime | Created Date |
deviceId (primary key) | Individual Id (primary key) |
firstName | First Name |
isAnonymous | Is Anonymous |
lastName | Last Name |
userName | External Record Id |
Map the following fields in your website connector’s party identification DLO to the DMO.
partyIdentification DLO Field | Party Identification DMO Field |
---|---|
dateTime | Created Date |
deviceId (primary key) |
|
IDName | Identification Name |
IDType | Party Identification Type |
userId | Identification Number |
For more information on data mapping in Data Cloud, see Data Mapping.