Data Collection

Before the Salesforce Interactions SDK can begin capturing data, initialize the Salesforce Interactions SDK and consent to track must be granted.

Initialization and consent can be accomplished through:

1SalesforceInteractions.init({
2  consents: [{
3    purpose: "Tracking", 
4    provider: "OneTrust", 
5    status: "Opt In"
6  }]
7})

If your site has existing consent management features, integrate those features with the Salesforce Interactions SDK to signal when the user has given consent to track.

Capturing User Engagement Data

To capture a customer interaction, call to the sendEvent function:

1SalesforceInteractions.sendEvent({
2    interaction : {
3        name : "View Catalog Object",
4        catalogObject: { 
5          type : "Product", 
6          id : "65e4e737",
7          attributes: {
8            description: "Shoes"
9          }
10        }
11    }
12    })

Capturing Profile Data

Capturing profile data is done in the same sendEvent function call:

1SalesforceInteractions.sendEvent({
2    user: {
3        attributes: {
4            email: 'user@domain.com'
5        }
6    }
7})

Capturing Profile and Engagement Data

When capturing profile data, you aren’t limited to that minimal interaction format. Any of the interaction data models can be combined with profile information to collect as much context for an event as possible.

1SalesforceInteractions.sendEvent({
2    interaction : {
3        name : "View Catalog Object",
4        catalogObject: { 
5          type : "Product", 
6          id : "65e4e737",
7          attributes: {
8            description: "Shoes"
9          }
10        }
11    },
12    user: {
13        attributes: {
14            email: 'user@domain.com'
15        }
16    }
17})