# Event Structure

The Salesforce Interactions Web SDK captures every customer interaction and behavior through a standardized event structure. Each event combines system-generated properties and context (automatically set by the SDK) and developer-defined data (set by you) to build comprehensive customer profiles and track meaningful interactions.

Every event captured by the Salesforce Interactions Web SDK follows a consistent structure with these properties.

| Field         | Provided By | Type        | 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, including URL, referrer, channel, and locale information.                                                |
| `time`        | SDK         | Time        | Shows the timestamp of the event in milliseconds elapsed since the UNIX epoch.                                                                   |
| `user`        | Developer   | User        | Captures profile event data for a customer. Used to build comprehensive customer profiles.                                                       |

## Developer Provided Data

The `interaction`, `user`, and `account` fields are your responsibility to populate when sending an event. These fields contain core data about the customer and their interactions.

- `interaction`

  - : This field captures the customer's engagement event data. At a minimum, an interaction requires a valid `name` value. The SDK supports several specialized interaction types that map to Data 360's unified data model:
    - [Cart Interaction](/docs/data/salesforce-interactions-sdk/guide/c360a-api-cart-interaction.md)
    - [Catalog Interaction](/docs/data/salesforce-interactions-sdk/guide/c360a-api-catalog-interaction.md)
    - [Order Interaction](/docs/data/salesforce-interactions-sdk/guide/c360a-api-order-interaction.md)

- `user`

  - : This field captures the individual [user's](/docs/data/salesforce-interactions-sdk/guide/c360a-api-user-data.md) profile data (for example, email, loyalty ID, and first name). This data is crucial for user identification and profile enrichment.

- `account`

  - : This field captures profile data at the [account](/docs/data/salesforce-interactions-sdk/guide/c360a-api-account-data.md) level. Use this to group interactions across multiple individual users belonging to the same company or account.

## SDK-Generated Data

Salesforce Interactions SDK automatically populates these fields for every event, providing necessary context and tracking identifiers.

- `source`

  - : This field provides the context of the event, including the page `url`, the `channel` (always `Web` when using the Interactions SDK), and the current `locale`.

- `time`

  - : The precise server timestamp of the event capture.

  > **Note**: The `dateTime` value is derived from the user's browser/client clock (generated in UTC ISO-8601 format using JavaScript `Date(...).toISOString()`). If the user's device time is incorrect or unsynced, this value can be skewed significantly (past/future).

- `pageView`

  - : A flag indicating if the event was part of the initial page load process.

- `consents`

  - : An array containing the current consent status, which is included automatically when the status changes or on the first event after initialization.

## Example

This example shows how a call to `SalesforceInteractions.sendEvent()` is expanded by the Interactions SDK into the complete, verbose event object containing all system-generating tracking and contextual data.

This call captures behavioral (`interaction`) and profile (`user`) data from a site instrumented using the Interactions SDK.

```javascript
SalesforceInteractions.sendEvent({
  interaction: {
    name: "View Catalog Object",
    catalogObject: {
      type: "Product",
      id: "product-1",
    },
  },
  user: {
    attributes: {
      email: "user@domain.com",
    },
  },
});
```

Here’s what the complete, captured event structure looks like, including all automatically-included fields.

```javascript
{
  interaction: {
    name: "View Catalog Object",
    catalogObject: {
      type: "Product",
      id: "product-1"
    }
  },
  source: {
    pageType: "homepage",
    url: "https://my.domain.com/home",
    urlReferrer: "https://my.domain.com/search",
    channel: "Web",
    locale: "en_US"
  },
  user: {
    anonymousId: "aa19dc4fcdc636d8", // Automatically assigned by the SDK
    attributes: {
      email: "user@domain.com"
    }
  },
  consents: [{
    purpose: 'Tracking',
    provider: 'Example Provider',
    status: 'Opt In',
  }]
  pageView: 0, // Automatically set by the SDK
  time: 1628700769593 // Automatically set timestamp
}
```

**See Also**

- [Translation of SDK Events to Web Connector Schemas](/docs/data/salesforce-interactions-sdk/guide/c360a-api-translating-sdk-events-to-web-connector-schemas.md)
- [Custom Events](/docs/data/salesforce-interactions-sdk/guide/c360a-api-custom-events.md)
