Custom Events
Interactions SDK provides recommended interaction data models like Cart Interaction, Catalog Interaction, and Order Interaction that help you leverage the unified data model across Salesforce. In addition to these standard models, you can also define Custom Events to capture proprietary or highly specific user actions.
Custom Events ensure that unique behavioral data relevant to your business is also ingested into the unified data model in Data Cloud.
Unlike standard interactions, Custom Events require a two-step definition process: setting up the schema in Data Cloud and then instrumenting the SDK call.
Before sending the event, you must modify your Web Connector schema in Data Cloud to define the event's unique name and it's expected custom fields.
- Once your custom schema is created and deployed, you can't make changes (deletions or edits) to its structure.
- The SDK automatically converts custom event fields that aren't already in standard format to camel-case for Data Cloud ingestion. For example, a field labelled
Developer NAMEin the schema will be correctly mapped todeveloperNamewhen processed.
This example illustrates how to define a custom event names myCustomEvent:
This example schema is provided for illustrative purposes only. Don't use it without modification in your Web Connector, as it may not align with all implementation goals.
To capture and send the custom event from your website, use the SalesforceInteractions.sendEvent() function and specify the eventType or name field, and required fields that aren’t set via Automatic Population of Required Data Cloud Fields to capture this event.
The SDK combines your data with the automatically populated fields and transforms the field names to match your Web Connector schema before sending it to Data Cloud.
If the eventType isn’t explicitly provided, but name is, the SDK automatically sets its value to match the value of name.