Integrations
Salesforce Interaction SDK features built-in CustomEvents you can use for binding
listeners to events that are specific to the Web SDK. Data passed by these events are in the
detail properties of the event object passed to a listener's callback function.
The Salesforce Interaction 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 | The OnConsentRevoke event is dispatched when a user has given consent but later revokes that consent. |
| OnEventSend | The OnEventSend event is dispatched whenever a request to the Event
API is sent via SalesforceInteractions.sendEvent. This event contains the
actionEvent payload processed in the event
pipeline. |
| OnException | The OnException 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 | The OnInit 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 have to reinitialize without a page load event. |
| OnInitSitemap | The OnInitSitemap event is dispatched whenever the Web SDK sitemap
is initialized via the SalesforceInteractions.initSitemap
function. |
| OnPageMatchStatusUpdated | The OnPageMatchStatusUpdated 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 shows anytime the Web SDK assigns a new tracking identity to a customer. |
| OnShutDown | The OnShutDown event is dispatched when the Web SDK is given 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})