---
schema_version: "1"
id: 84d06decabb3766f78c0738a31e57ba0d52bb9e0957754c7f24e32958dbc7626
title: Capture Engagement Data (Version 3.x)
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/data-cloud/data-cloud-engagement-mobile-sdk/guides/c360a-api-engagement-mobile-sdk-capturing-engagement-data-v3.md
canonical_url: https://developer.salesforce.com/docs/data/data-cloud-engagement-mobile-sdk/guide/c360a-api-engagement-mobile-sdk-capturing-engagement-data-v3.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 45d75333c1568f5f084802d593357324b16cfc0226f23af470510db4734a2795
products:
  - Data 360 Engagement Mobile SDK
  - Data 360 Developer Documentation
---
# Capture Engagement Data (Version 3.x)

The Data 360 Module for the Engagement Mobile SDK enables the collection of rich engagement data from customer interactions within your mobile application through event tracking.

## Prerequisites

Before engagement data can be sent to Data 360:

- The Data 360 Module for the Engagement Mobile SDK must be configured and [initialized](https://developer.salesforce.com/docs/data/data-cloud-engagement-mobile-sdk/guide/c360a-api-engagement-mobile-sdk-initialization.md).
- [Consent](https://developer.salesforce.com/docs/data/data-cloud-engagement-mobile-sdk/guide/c360a-api-engagement-mobile-sdk-consent-management.md) to track engagement data must be granted.

**note:** `SFMCSdk.track(event:)` calls are silently dropped (not queued) when consent is `optOut` or when the event type is blocked during `pending`. Set consent before or immediately after SDK initialization.

## Supported Event Types

The Engagement Mobile SDK supports two types of events — structured and unstructured events. Both event types are collected using the `SFMCSdk.track(event)` function.

### Structured Events

Structured events have predefined schemas with strict data requirements. They come pre-configured with the Mobile Connector schema for Data 360 and can be extended to capture additional custom data. The Data 360 Module supports the following structured events.

- Cart Event: Track shopping cart interactions
- Catalog Event: Monitor product catalog engagement
- Order Event: Capture purchase and order data

### Unstructured Events

Unstructured events have no predefined data requirements. You must create and add custom event definitions to the Mobile Connector schema for Data 360 ingestion.

## Implementation Examples

```
import Cdp
import SFMCSDK

...

// Add to cart
SFMCSdk.track(event: AddToCartEvent(
    lineItem: LineItem(
        catalogObjectType: "Product",
        catalogObjectId: "product-001",
        quantity: 1,
        price: 29.99,
        currency: "USD"
    )
))

// Purchase order
SFMCSdk.track(event: PurchaseOrderEvent(
    order: Order(
        id: "order-001",
        lineItems: [
            LineItem(catalogObjectType: "Product", catalogObjectId: "product-001", quantity: 1)
        ],
        totalValue: 29.99,
        currency: "USD"
    )
))

// View catalog object
SFMCSdk.track(event: ViewCatalogObjectEvent(
    catalogObject: CatalogObject(
        type: "Product",
        id: "product-001",
        attributes: ["promoCode": "WINTER2025"],
        relatedCatalogObjects: [
            "sizes": ["S", "M", "L"]
        ]
    )
))

// Custom event
if let event = CustomEvent(
    name: "myCustomEvent",
    attributes: [
        "giftWrap": true,
        "giftMessage": "Happy Birthday"
    ]
) {
    SFMCSdk.track(event: event)
}
```

**note:** `CustomEvent(name:attributes:)` returns an optional — the call returns `nil` if the name is empty or contains invalid characters.

### Android

On Android, the preferred pattern is calling `.track()` directly on the event object. This makes null-safety explicit at the call site (event construction can return null on invalid input). The older `SFMCSdk.track(CartEvent.add(...))` form still works — both patterns route through the same event bus.

```
import com.salesforce.marketingcloud.sfmcsdk.components.events.CartEvent
import com.salesforce.marketingcloud.sfmcsdk.components.events.EventManager

...

// Add to cart
CartEvent.add(LineItem(
    catalogObjectId = "SKU-123",
    catalogObjectType = "Product",
    quantity = 1,
    price = 9.99,
    currency = "USD"
))?.track()

// View catalog object
CatalogEvent.view(CatalogObject(
    id = "SKU-123",
    type = "Product"
))?.track()

// Purchase order
OrderEvent.purchase(Order(
    id = "order-1",
    totalValue = 29.99,
    currency = "USD",
    lineItems = listOf(
        LineItem(
            catalogObjectId = "SKU-123",
            catalogObjectType = "Product",
            quantity = 1,
            price = 29.99,
            currency = "USD"
        )
    )
))?.track()

// Custom event (via sfmcsdk event bus — recommended)
EventManager.customEvent(
    name = "level_complete",
    attributes = mapOf("level" to 5)
)?.track()
```

