---
schema_version: "1"
id: 08e181c2a56b4884a1c2f4c37748ae69aa4022c4604156531db3c418a0729a15
title: Data Collection
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/data-cloud/interactions-sdk/guides/c360a-api-data-collection.md
canonical_url: https://developer.salesforce.com/docs/data/salesforce-interactions-sdk/guide/c360a-api-data-collection.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 6474c9b5f26ae09d60c363cb0c8327a32987d5fab03550109f611e11dabc3259
products:
  - Salesforce Interactions SDK
  - Data 360 Developer Documentation
---
# Data Collection

Before the Salesforce Interactions SDK can begin capturing data, initialize the Salesforce Interactions SDK and gain the user’s consent to track their activity.

If your site has an existing consent management platform, integrate its signals with the SDK's `init` function to confirm the user has granted permission to track.

```javascript
SalesforceInteractions.init({
  consents: [
    {
      purpose: "Tracking",
      provider: "OneTrust",
      status: "Opt In",
    },
  ],
});
```

For more information, see [Initialization](https://developer.salesforce.com/docs/data/salesforce-interactions-sdk/guide/c360a-api-initialization.md) and [Consent](https://developer.salesforce.com/docs/data/salesforce-interactions-sdk/guide/c360a-api-consent.md)

## Capture User Engagement Data

Once initialization is complete, you can track a user's actions by sending an interaction object within the `sendEvent()` function's payload. The `name` field of the interaction specifies the type of action that occurred.

This is the foundation for understanding user behavior, tracking conversions, and personalizing the user experience.

```javascript
// Example: Tracking when a user views a specific product.
SalesforceInteractions.sendEvent({
  interaction: {
    name: "View Catalog Object",
    catalogObject: {
      type: "Product",
      id: "65e4e737",
      attributes: {
        description: "Classic black running shoes",
      },
    },
  },
});
```

## Capture Profile Data

To identify a user or update their profile attributes, send a `user` object within the `sendEvent()` function's payload. This is essential for building a unified profile of your customer across different sessions and devices.

```javascript
SalesforceInteractions.sendEvent({
  user: {
    attributes: {
      email: "user@domain.com",
    },
  },
});
```

## Combine Profile and Engagement Data

When capturing profile data, you aren’t limited to that minimal interaction format. You can combine any of the interaction data models with profile information to collect as much context for an event as possible.

```javascript
SalesforceInteractions.sendEvent({
  interaction: {
    name: "View Catalog Object",
    catalogObject: {
      type: "Product",
      id: "65e4e737",
      attributes: {
        description: "Classic black running shoes",
      },
    },
  },
  user: {
    attributes: {
      email: "user@domain.com",
    },
  },
});
```
