SalesforceInteractions.init({
cookieDomain: "company.com",
}).then(() => {
// This block executes only if initialization is successful
const sitemapConfig = {
global: {},
pageTypes: [],
};
SalesforceInteractions.initSitemap(sitemapConfig); // Initializes the Sitemap
}).catch((error) => {
// This block executes if initialization fails
console.error("Initialization failed:", error);
});
Initializing Salesforce Interactions SDK:
SalesforceInteractions.init({
cookieDomain: "company.com",
})
SalesforceInteractions.init is a method that initializes the Personalization module of the Salesforce Interactions SDK.
It takes an object as a parameter to configure initialization options.
cookieDomain: "company.com": This is an optional setting that specifies the domain for the tracking cookies. If not set, it defaults to the current domain. Setting this can be useful for tracking users across subdomains.
Handling the Initialization Promise:
.then(() => {
//...
});
.then(() => {...}) is used to handle the promise returned by SalesforceInteractions.init. This means the code inside the then block will execute only after the SDK is successfully initialized.
Sitemap Configuration Object:
sitemapConfig is an object that holds the configuration for the Sitemap.
global: {}: This object can be used to hold global site configurations, such as settings that apply to all pages.
pageTypes: []: This array is intended to hold configurations for different page types on the website (e.g., Home page, Product page, etc.).
const sitemapConfig = {
global: {},
pageTypes: [],
};
Initializing the Sitemap:
SalesforceInteractions.initSitemap(sitemapConfig);
SalesforceInteractions.initSitemap is a method that initializes the Sitemap using the configuration provided in sitemapConfig.
This method ensures that the SDK knows about the different types of pages on the site and can track user interactions accordingly.