🚀 How to leverage the Salesforce Web Interaction SDK for capturing website interactions and seamlessly integrating them with Salesforce Data Cloud! 🌐💼
This powerful combination enhances data collection and analytics, enabling businesses to make informed decisions and drive growth. Let's connect and explore how this can transform your digital strategy! #WebSDK #Salesforce #DataIntegration #DigitalTransformation
The Salesforce Interactions Web SDK Data Cloud Module enables the creation of behavioral profiles and audience segmentation, as well as the integration of these profiles and segments with Salesforce. This is achieved by collecting customer interactions/events, i.e Engagement Events such as Cart, Catalogue, Consent, and Order, alongside Profile Events like Contact Point Email, Contact Point Phone, Contact Point Address, Identity/Individual, and Party on a website. Furthermore, the Salesforce Interactions Web SDK offers features such as Identity Management, Cookie Management, Site Maps, and Integration Hooks.
Data Collection and Tracking: The sendEvent API call serves as a mechanism to record user interactions and gather relevant data from a website, subsequently transmitting it to the Data Cloud. The interaction event may encompass both "Engagement Data" and "Profile Data."
Engagement Data: This refers to information regarding user interactions on the website. Examples include viewing a catalog, adding an item to the shopping cart, or loading a page.
Profile Data: This pertains to the individual utilizing the website. The user may be either anonymous, identified by a cookie-generated Anonymous ID, or identifiable by a name, such as an email address.
SalesforceInteractions.[sendEvent]({ —-----------------> Method that sends an interaction event to Data Cloud
[ interaction : {
name : "View Catalog Object",----------------------> Engagement Data
catalogObject: {
type : "Product",
id : "65e4e737",
attributes: {
description: "Shoes"
}
}
}
})]
user: {
attributes: {
email: ‘abc@xyz.com’----------------------------> Profile Data
}
}
Identity and Cookie Management: An anonymous individual is defined as a new visitor to the website. The software development kit (SDK) creates a unique Anonymous ID that is saved in a first-party cookie. If the same individual returns, the Anonymous ID will already be present in the cookie. However, upon logging in {event_login}, the anonymous profile is merged with the newly created known profile. This process enables the SDK to transmit profile attributes, such as the email address, to the Data Cloud as part of the profile data.
Fig. 1.1
To enable cookie sharing across various domains, it is essential to set up the Salesforce Interactions Web SDK with the appropriate shared domain name.
For instance, to facilitate cookie sharing between the following two domains:
abc.domain.com
xyz.domain.com
You can configure the cookie domain as follows:
SalesforceInteractions.init({
cookieDomain: 'domain.com'
})
Consent Management: The Salesforce Interactions Web SDK is configured to [sendEvent] solely when the customer has granted permission for cookie tracking. In the event that the user revokes their consent, the Salesforce Interactions Web SDK promptly records this preference and ceases the transmission of these events to Data Cloud without delay. Customer consent can be obtained by configuring the system or by utilizing the Consent API within the Salesforce Interactions SDK.
For example:
Status: ‘opt in’
SalesforceInteractions.init({
consents: [{
provider: 'ExampleProvider',
purpose: 'Tracking',
status: 'Opt In'
}]
})
Status: ‘opt out
SalesforceInteractions.init({
consents: [{
provider: 'ExampleProvider',
purpose: 'Tracking',
status: 'Opt out'
}]
})
Methods for obtaining opt-in or opt-out consent include:
1. Initializing the SDK through SalesforceInteractions.init.
2. Executing an API call via SalesforceInteractions.updateConsent whenever an individual modifies their preferences.
Recommended Approach: The recommended approach is to provide a Promise for the consent during Initialization. For example:
SalesforceInteractions.init({
consents: new Promise(resolve => {
// user clicks button that grants consent
document.getElementById('opt-in')
.addEventListener('click', () => {
resolve([{
provider: 'Test Provider',
purpose: SalesforceInteractions.ConsentPurpose.Tracking,
status: SalesforceInteractions.ConsentStatus.OptIn
}])
}, { once: true })
// user clicks button that revokes consent
document.getElementById('opt-out')
.addEventListener('click', () => {
resolve([{
provider: 'Test Provider',
purpose: SalesforceInteractions.ConsentPurpose.Tracking,
status: SalesforceInteractions.ConsentStatus.OptOut
}])
}, { once: true })
})
})
Sitemap:
Record page navigation activities. For instance, when a user transitions from the Home page to the Category page, it is possible to capture both the navigation data and supplementary tracking information, which can then be transmitted to the Data Cloud. Consolidated Data Capture Logic. For example, the Sitemap enhances data collection by utilizing a shared data collection framework across various pages, rather than implementing separate data collection mechanisms for each component on every page. In other words, instead of employing [sendEvent] for each 'click' component within a module on every page, one can utilize 'listeners' to monitor a specific event, such as event_click, and subsequently trigger the sendevent API call within the listener. This approach promotes a Global strategy as opposed to a Local strategy.
Initialization: The suggested initialization procedure for the Salesforce Interactions SDK.
Consent
Identity
Data Collection:
SalesforceInteractions.sendEvent
SalesforceInteractions.initSitemap
SalesforceInteractions.init({
consents: [...], —-------------------------------------------------> 1. Consent
cookieDomain: '...'----------------------------------------------> 2. Identity
}).then(() => {
SalesforceInteractions.sendEvent({-------------------->3. Data Collection: a.
interaction : {
name : "View Catalog Object",
catalogObject: {
type : "Product",
id : "65e4e737",
attributes: {
description: "Shoes"
}
}
}
})
OR
SalesforceInteractions.initSitemap({-------------------->3. Data Collection: b.
global: { ... },
pageTypeDefault: { ... },
pageTypes: [...]
})
})
Data Cloud Module Interactions Web SDK Integration: The process for integrating the Web SDK is akin to that of the Streaming Ingestion API and involves multiple steps:
1. Configure the Website and Mobile Application Connector in Data Cloud Setup.
2. Establish and implement the data stream.
3. Integrate the data capture functionality into your website.
1. Configure the Website and Mobile App Connector:
Within the Data Cloud setup, proceed to the Data Cloud Setup section.
Choose the option to create a New connector under Website & Mobile Apps.
Designate Website as the connector Type.
Upload a schema file that outlines the structure of the data you intend to monitor for each event tracked from the website.
Ensure that the schema is formatted in JSON.
This schema encompasses the following mappings:
Engagement Events:
Cart Interaction Mapping
Catalog Interaction Mapping
Order Interaction Mapping
Consent Event Mapping
Profile Events: The Profile Events outlined in a Web Connector Schema are associated with Individual data streams upon deployment:
Contact Point Email Mapping
Contact Point Phone Mapping
Identity Mapping
Party Identification Mapping
2. Establish a Data Stream for the Website connector that was configured in the setup of step 1:
Go to Data Stream and select New/Website.
Choose the connector for which you wish to create a stream.
Within the selected connector, identify all the events or objects you wish to monitor, such as Cart, Cart Item, Consent, etc.
Deploy the Data Stream.
3. Incorporate the Salesforce Interactions Web SDK into your website: Implement the data capture functionality within your site.
Adhere to the guidelines provided for integrating the SDK on the Connector Page Setup within Data Cloud.
If utilizing Experience Cloud, modify the head markup to include the script tag.
Utilize the init method to initialize the SDK.
Upon clicking a module, invoke the sendEvent API from the Salesforce Web SDK to record an interaction, such as (Event_View), along with the Consent and User ID (individual ID) in Salesforce Data Cloud or the Anonymous ID.
Finally, to validate data in the Data Cloud, proceed to the Data Explorer and select the Data Lake Object or Event Object that requires validation.
Comments
Post a Comment