> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zeotap.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Track Events

> Send custom events with properties to Zeotap.

<Warning>
  **Important:** Please ensure your CMP configuration includes new **Vendor ID 1469** for 1st Party data tracking. Additionally, include **Vendor ID 301** if cookie sync is enabled. [Learn more](/articles/sdks/web-js/configurations/consent-options#shouldcheckzeotapvendorconsent)
</Warning>

The `setEventProperties` method is used to send custom events to Zeotap along with specified event properties and name.

## Syntax

```java theme={null}
Collect.getInstance().setEventProperties(String eventName, Map<String, Object> eventProperties, SDKCallback callback)
```

## Parameters

| Parameter       | Type                  | Required | Description                          |
| --------------- | --------------------- | -------- | ------------------------------------ |
| eventName       | `String`              | Yes      | The name of the event to track       |
| eventProperties | `Map<String, Object>` | No       | Key-value pairs of event properties  |
| callback        | `SDKCallback`         | No       | Callback function to handle response |

## Usage Examples

### Event Name Only

```java theme={null}
// Track event with name only
Collect.getInstance().setEventProperties("app_opened");
```

The payload with event name only:

```json title="Event name only in payload" {3-6} theme={null}
    "events": [
        {
            "event": {
                "eventName": "app_opened",
                "eventTimestamp": 1745959356443
            },
            "user": {
                "zi": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
            },
            "page": { /* ... */ },
            "version": "2.2.8"
        }
    ]
```

### Basic Event Tracking

```java theme={null}
Map<String, Object> eventProperties = new HashMap<>();
eventProperties.put("product_name", "Wireless Headphones");
eventProperties.put("category", "Electronics");
eventProperties.put("price", 99.99);
eventProperties.put("currency", "USD");

Collect.getInstance().setEventProperties("product_viewed", eventProperties);
```

The payload with event name and properties:

```json title="Event with properties in payload" {3-10} theme={null}
    "events": [
        {
            "event": {
                "eventName": "product_viewed",
                "product_name": "Wireless Headphones",
                "category": "Electronics",
                "price": 99.99,
                "currency": "USD",
                "eventTimestamp": 1745959356443
            },
            "user": {
                "zi": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
            },
            "page": { /* ... */ },
            "version": "2.2.8"
        }
    ]
```

### Event with Callback

```java theme={null}
Map<String, Object> eventProperties = new HashMap<>();
eventProperties.put("order_id", "ORD-12345");
eventProperties.put("total_amount", 249.99);

Collect.getInstance().setEventProperties("purchase_completed", eventProperties, (response) -> {
    // Handle success/error response
});
```

## Best Practices

### Event Naming

* Use descriptive, snake\_case names: `product_viewed`, `checkout_completed`
* Be consistent across your application
* Avoid special characters and spaces

### Property Structure

```java theme={null}
// Good: Flat structure with descriptive keys
Map<String, Object> props = new HashMap<>();
props.put("product_id", "PROD-123");
props.put("product_name", "Wireless Mouse");
props.put("category", "Electronics");
props.put("price", 29.99);
```

## Related Methods

* [setInstantEventProperties](/articles/sdks/android/api-reference/set-instant-event-properties) - Send events immediately bypassing the queue
* [setPageProperties](/articles/sdks/android/api-reference/set-page-properties) - Set page/screen context
* [setUserProperties](/articles/sdks/android/api-reference/set-user-properties) - Set user attributes

***

For more examples and advanced usage patterns, see our [Examples Guide](/articles/sdks/android/examples).
