Integrate the Salesforce Interactions SDK

To integrate the Salesforce Interactions SDK with your website and enable personalization capabilities, do the following.

  1. Create a data space
  2. Create a website connector
  3. Upload your event schema
  4. Install the Interactions SDK on your website
  5. Create and upload a sitemap
  6. Create a website data stream
  7. 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.

  1. Go to Data Cloud Setup.

  2. Under Data Management, click Data Spaces.

  3. Click New, and give the data space a unique name.

  4. 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.

  5. Add an optional description about the purpose of the data space.

  6. Click Save.

See Also

To capture website data and control the scope of data ingestion, connect your website to Data Cloud by creating a website connector.

  1. Go to Data Cloud Setup.
  2. Under CONFIGURATION, click Websites & Mobile Apps.
  3. Click New.
  4. Provide a Connector Name.
  5. 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.

  1. Download the recommended schema file or use your own custom schema file.
  2. To upload the schema file, click Upload Schema under the Schema block.
  3. Confirm that all events and their associated fields are populated correctly.
  4. Click Save.

After you upload the schema, examine it for accuracy.

  1. 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.

  2. To update your schema, click Yes, Update.

  3. To view the full schema you uploaded, click View Full Schema.

See Also

After you’ve created a connector for your website and configured your event schema, you can install the Interactions SDK on your website.

  1. Scroll down to the Integration Guide section at bottom of the website connector setup page.
  2. Copy the Content Delivery Network (CDN) URL.
  3. Add the script to the <head> section of your website’s code using a <script> tag.
  4. 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.

  1. Install the Salesforce Interactions SDK Launcher Chrome extension.
  2. Enable and access the Sitemap Editor on your website through the extension.
  3. Use the Sitemap Editor to instrument your website’s sitemap.
  4. Create a JavaScript file named sitemap.js.
  5. Copy the sitemap code you created and paste it into this file.
  6. Navigate to the Sitemap section of the website connector setup page.
  7. Click Upload and upload the sitemap.js file you created.
  8. 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.

  1. In Data Cloud, navigate to the Data Streams tab and click New.

  2. Under Connected Sources, click Website and then click Next.

  3. From the Website dropdown menu, select the website connector you configured.

  4. 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 category Profile.

  5. Review and verify the events you selected and their associated fields.

  6. Click Next.

  7. 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.

  8. For every profile event you’re capturing, use the Refresh Mode dropdown to select the data refresh mode as either Incremental or Partial.

  9. 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.

SectionDLO FieldMap to DMODMO Field
All Event DatadateTimeProduct Browse EngagementCreated Date
Shopping Cart EngagementCreated Date
All Event DatadeviceIdProduct Browse EngagementIndividual
Shopping Cart EngagementIndividual
All Event DataeventId (primary key)Product Browse EngagementProduct Browse Engagement Id (primary key)
Shopping Cart EngagementShopping Cart Engagement Id (primary key)
cartNot mappedNot mappedNot mapped
cartItemcartItem.catalogObjectIdShopping Cart EngagementProduct
cartItemcateItem.catalogObjectTypeShopping Cart EngagementProduct Category
cartItemcartItem.currencyShopping Cart EngagementCurrency
cartItemcartItem.priceShopping Cart EngagementProduct Price
cartItemcartItem.quantityShopping Cart EngagementProduct Quantity
cartItemeventTypeShopping Cart EngagementEngagement Type
catalogcatalog.idProduct Browse EngagementProduct
catalogcatalog.interactionNameProduct Browse EngagementEngagement Channel Action
catalogeventTypeProduct Browse EngagementEngagement Type
consentLogNot mappedNot mappedNot mapped
orderNot mappedNot mappedNot mapped
orderItemNot mappedNot mappedNot mapped

Ensure that no fields are mapped in your website connector’s contact point address DLO to the DMO.

contactPointAddress DLO FieldContact Point Address DMO Field
Not mapped

Map the following fields in your website connector’s contact point email DLO to the DMO.

contactPointEmail DLO FieldContact Point Email DMO Field
dateTimeCreated Date
deviceId (primary key)
  • Contact Point Email Id (primary key)
  • Party
emailEmail Address

Map the following fields in your website connector’s contact point phone DLO to the DMO.

contactPointPhone DLOContact Point Phone DMO Field
dateTimeCreated Date
deviceId (primary key)
  • Contact Point Phone Id (primary key)
  • Party
phoneNumberTelephone Number

Map the following fields in your website connector’s identity DLO to the DMO.

identity DLO FieldIndividual DMO Field
dateTimeCreated Date
deviceId (primary key)Individual Id (primary key)
firstNameFirst Name
isAnonymousIs Anonymous
lastNameLast Name
userNameExternal Record Id

Map the following fields in your website connector’s party identification DLO to the DMO.

partyIdentification DLO FieldParty Identification DMO Field
dateTimeCreated Date
deviceId (primary key)
  • Party
  • Party Identification Id (primary key)
IDNameIdentification Name
IDTypeParty Identification Type
userIdIdentification Number

For more information on data mapping in Data Cloud, see Data Mapping.