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

# User Events

> [!NOTE]
>
> **Prerequisites** \\
>
> Tracking needs to be enabled during SDK initialization for this feature to work.
> Set `CastledConfigs.enableTracking` to `true` to enable tracking.

You can monitor any user actions occurring within your app utilizing the `CastledNotifications.logCustomEvent` method provided by the Castled SDK.

Each event can be accompanied by relevant parameters. For instance, the `added_to_cart` event can include parameters
like `number_of_items` and `value_of_items`, allowing you to capture more detailed information about the user’s interaction.

### Logging User Events

`CastledNotifications.logCustomEvent` can be used to log user events. Any params associated with the events is passed to the method as a flatmap.

```kotlin kotlin
    // User event without params
    CastledNotifications.logCustomAppEvent(
        this,
        "upgraded_to_pro"
    );

    // User event with params
    CastledNotifications.logCustomAppEvent(
        this,
        "cart_checked_out",
        mapOf(
            "value" to 1042.56,
            "isPrime" to true,
            "delivery_on" to "09-30-2023"
        )
    );
```

All the user events logged will eventually land in the user events tables in your configured data warehouse, which can be used for any segmentation in future.
Also these events can be used as the **trigger events** for your push, inapp and inbox campaigns or workflows.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.