Custom Events
Use the recommended Cart Interaction, Catalog Interaction, and Order Interaction data
models provided by the Salesforce Interactions SDK to use the unified data model across
Salesforce. You can create and capture custom events in addition to the recommended interaction
data models.
Define the shape of the custom event in the Web Connector schema. For
example:
1{
2 "records": [
3 {
4 "developerName": "myCustomEvent",
5 "masterLabel": "My Custom Event",
6 "category": "Engagement",
7 "externalDataTranFields": [
8 {
9 "masterLabel": "My Custom Field",
10 "dataType": "Text",
11 "developerName": "myCustomField",
12 "isDataRequired": true
13 },
14 {
15 "masterLabel": "eventId",
16 "dataType": "Text",
17 "developerName": "eventId",
18 "isDataRequired": true
19 },
20 {
21 "masterLabel": "category",
22 "dataType": "Text",
23 "developerName": "category",
24 "isDataRequired": true
25 },
26 {
27 "masterLabel": "dateTime",
28 "dataType": "DateTime",
29 "developerName": "dateTime",
30 "isDataRequired": true
31 },
32 {
33 "masterLabel": "deviceId",
34 "dataType": "Text",
35 "developerName": "deviceId",
36 "isDataRequired": true,
37 "primaryIndexOrder": 1
38 },
39 {
40 "masterLabel": "eventType",
41 "dataType": "Text",
42 "developerName": "eventType",
43 "isDataRequired": true
44 },
45 {
46 "masterLabel": "sessionId",
47 "dataType": "Text",
48 "developerName": "sessionId",
49 "isDataRequired": true
50 }
51 ]
52 }
53 ]
54}Then, in Salesforce Interactions SDK, specify the eventType or name field, and required fields that aren’t set via Automatic Population of Required CDP Fields to capture this event.
1SalesforceInteractions.sendEvent({
2 interaction: {
3 name: 'myCustomEvent',
4 eventType: 'myCustomEvent',
5 myCustomField: 'some value'
6 }
7})