# Capture Engagement Data (Version 2.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](/docs/data/data-cloud-engagement-mobile-sdk/guide/c360a-api-engagement-mobile-sdk-initialization.md).
- [Consent](/docs/data/data-cloud-engagement-mobile-sdk/guide/c360a-api-engagement-mobile-sdk-consent-management.md) to track engagement data must be granted.

## 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

```sfdocs-code {"lang":"swift", "title": "iOS", "src": "" }
import SFMCSDK
import Cdp

...

// collecting the structured AddToCartEvent
SFMCSdk.track(AddToCartEvent(
    lineItem: LineItem(
        catalogObjectType: "Product",
        catalogObjectId: "product-1",
        quantity: 1,
        price: 20.0,
        currency: "USD",
        // attributes can contain any custom field data
        // as long as the schema is modified to define them
        attributes: [
            "gift_wrap": false
        ]
    )
))

// collecting an unstructured CustomEvent
SFMCSdk.track(CustomEvent(
    name: "CartAbandonment",
    attributes: [
        "sku": "COFFEE-NTR-06",
        "price": 19.99
    ]
))
```

### Android

```sfdocs-code {"lang":"kotlin", "title": "Android", "src": "" }
import com.salesforce.marketingcloud.sfmcsdk.components.events.CartEvent
import com.salesforce.marketingcloud.sfmcsdk.components.events.EventManager
import com.salesforce.marketingcloud.sfmcsdk.SFMCSdk

...

// collecting the structured AddToCartEvent
SFMCSdk.track(CartEvent.add(
    lineItem = LineItem(
        catalogObjectId = "product-1",
        catalogObjectType = "Product",
        quantity = 1,
        price = 20.0,
        currency = "USD",
        // attributes can contain any custom field data
        // as long as the schema is modified to define them
        attributes = mapOf(
            "gift_wrap" to false
        )
    )
))

// collecting an unstructured CustomEvent
SFMCSdk.track(EventManager.customEvent(
    "CartAbandonment",
    mapOf(
        "sku" to "COFFEE-NTR-06",
        "price" to 19.99
    )
))
```
