Event Structure

An event collected by Salesforce Interactions Web SDK contains properties that are automatically set by the system and optional properties that are set by you.
Fields Provided By About Description
account Developer Account Captures profile event data for an account.
consents SDK Consents Contains a list of consent values attached to the first event captured after a customer consents to tracking or when a customer revokes consent.
interaction Developer Interaction Captures customer engagement event data.
pageView SDK Page View Indicates if the event was captured during a page load.
source SDK Source Contains event metadata about the page.
time SDK Time Shows the timestamp of the event in milliseconds elapsed since the UNIX epoch.
user Developer User Captures profile event data for of a customer.

Developer Provided Data

The interaction field is for capturing customer engagement data. At a minimum, an interaction requires a valid name value. Salesforce Interactions Web SDK come with several specialized interaction types, such as:

The user field captures the customer’s user profile data.

The account field captures profile data at the account level. The account fields allow you to capture data for many customers in one account.

Example

Salesforce Interactions Web SDK is used to instrument a site to capture events containing both behavioral and profile data.
1SalesforceInteractions.sendEvent({
2  interaction: {
3    name: "View Catalog Object",
4    catalogObject: {
5      type: "Product",
6      id: "product-1"
7    }
8  },
9  user: {
10    attributes: {
11      email: "user@domain.com"
12    }
13  }
14})
Here’s what the captured results look like for this event structure.
1{
2  interaction: {
3    name: "View Catalog Object",
4    catalogObject: {
5      type: "Product",
6      id: "product-1"
7    }
8  },
9  source: {
10    pageType: "homepage",
11    url: "https://my.domain.com/home",
12    urlReferrer: "https://my.domain.com/search",
13    channel: "Web",
14    locale: "en_US"
15  },
16  user: {
17    anonymousId: "aa19dc4fcdc636d8",
18    attributes: {
19      email: "user@domain.com"
20    }
21  },
22  consents: [{
23    purpose: 'Tracking',
24    provider: 'Example Provider',
25    status: 'Opt In'
26  }]
27  pageView: false,
28  time: 1628700769593,
29}