Integrations
The Salesforce Interactions SDK features built-in CustomEvents that you can use to bind
listeners to events that are specific to the Web SDK. Data that these events pass are in the
detail properties of the event object passed to a listener’s callback function.
The Salesforce Interactions SDK built-in custom events.
1SalesforceInteractions.CustomEvents = {
2 OnBeforeEventSend: "interactions:onBeforeEventSend",
3 OnClearPersistedIdentities: "interactions:onClearPersistedIdentities",
4 OnConsentRevoke: "interactions:onConsentRevoke",
5 OnEventSend: "interactions:onEventSend",
6 OnException: "interactions:onException",
7 OnInit: "interactions:onInit",
8 OnInitSitemap: "interactions:onInitSitemap",
9 OnPageMatchStatusUpdated: "interactions:onPageMatchStatusUpdated",
10 OnResetAnonymousId: "interactions:onResetAnonymousId",
11 OnSetAnonymousId: "interactions:onSetAnonymousId",
12 OnShutDown: "interactions:onShutDown"
13}| Custom Event | Description |
|---|---|
| OnBeforeEventSend | This event shows before data passed to SalesforceInteractions.sendEvent is distributed to consuming modules. |
| OnClearPersistedIdentities | This event shows when SalesforceInteractions.clearPersistedIdentities is invoked. |
| OnConsentRevoke | This event is dispatched when a user gives consent but later revokes that consent. |
| OnEventSend | This event is dispatched whenever a request to the Event API sends via
SalesforceInteractions.sendEvent. This event contains the
actionEvent payload processed in the event
pipeline. |
| OnException | This event is dispatched when an operation fails and contains information about
the error and its context. You can use the OnException event for
debugging and logging runtime errors. |
| OnInit | This event is dispatched when the Web SDK is initialized. You can use the OnInit event for debugging single-page applications (SPA) where the beacon and the sitemap usually reinitialize without a page load event. |
| OnInitSitemap | This event is dispatched whenever the Web SDK sitemap is initialized via the
SalesforceInteractions.initSitemap
function. |
| OnPageMatchStatusUpdated | This event is dispatched whenever the match status of a sitemap’s page type is
updated. The matchStatus array accumulates every time an event is
dispatched, in the order the match statuses are updated. If the status is
running, the PageMatchStatus includes the
start time. Conversely, if the status is selected,
rejected, or matched, the
PageMatchStatus includes the end time. The
selected page type is the first page type to be matched. The
sitemap doesn’t evaluate other matched page
types. |
| OnResetAnonymousId | This event shows when SalesforceInteractions.resetAnonymousId is invoked. |
| OnSetAnonymousId | OnSetAnonymousId This event shows anytime the Web SDK assigns a new tracking identity to a customer. |
| OnShutDown | This event is dispatched when the Web SDK receives the signal to shut down. |
Example
1document.addEventListener('salesforce:onEventSend', (customEvent) => {
2 console.log('On Event Send: ', customEvent.detail)
3});
4
5SalesforceInteractions.sendEvent({
6 interaction: {
7 name: 'integration_hook_test'
8 }
9})