---
updatedAt: 2026-01-22T11:09:01.000Z
---

# Reporting Engagement Using Kotlin SDK

User engagement types include:

* **Impression (IMP):** Reports variation impressions.
* **Click (CLICK ):** Reports when users click a displayed variation of a custom API campaign or the widget of a Recommendation campaign.
* **Slot click (SLOT\_CLICK):** In Recommendations and Sorting Optimizer campaigns, reports exactly which product was clicked.
* **Slot impression (SLOT\_IMP):** For Restaurant Recommendation campaigns only. Reports an impression for one or more slots. Required in addition to IMP.
* **Push notification click (PN\_CLICK):** For Reconnect push notification campaigns only. Reports clicks on the notification.

The Mobile SDK offers two ways to report them:

* Using the Choice return object from the Choose Variations call
* Using the DYSdk object

## Using the Choice return object methods

Using the Choice object is typically the easiest way to report a user engagement.

### Reporting impressions

You can report an impression for a variation using the `Choice.Variation` object.

#### reportImpression

Returns [DYResult](https://dy.dev/dy-dev/docs/kotlin-sdk-references#dyresult)

| Parameter | description                                                                        | Data Structure  |
| :-------- | :--------------------------------------------------------------------------------- | :-------------- |
| branchId  | The branch ID (if relevant)                                                        | String? = null  |
| dayPart   | Define the period of the day the request relates to. Relevant only to Restaurants. | dayPart? = null |

**Example**

```kotlin
private suspend fun reportImpression() { 
    var result = DYSdk.getInstance().engagements.reportImpression( 
        decisionId = "decisionId", 
        variations = listOf(123,456,789), // optional 
        dayPart = DayPart.DINNER,// optional 
        branchId = "example-branch-id" // optional 
    ) 
 
    when (result.status) { 
        ResultStatus.SUCCESS -> TODO() 
        ResultStatus.ERROR -> TODO() 
        ResultStatus.WARNING -> TODO() 
    } 
} 

```

> **Note:** If you previously sent a Choose Variations request with `isImplicitImpressionMode` set to `true`, do not report impressions for the returned variations. Reporting them will result in counting duplicate impressions.

### Reporting clicks

You can report click for a variation using the `Choice.Variation` object.

#### reportClick

Returns [DYResult](https://dy.dev/dy-dev/docs/kotlin-sdk-references#dyresult)

| Parameter | description                                                                        | Data Structure |
| :-------- | :--------------------------------------------------------------------------------- | :------------- |
| branchId  | The branch ID (if relevant)                                                        | String? = nil  |
| dayPart   | Define the period of the day the request relates to. Relevant only to Restaurants. | dayPart? = nil |

**Example**

```kotlin
private suspend fun reportClickViaVariation() {
    var chooseResult = DYSdk.getInstance().chooseVariations( 
        selectorNames = listOf("campaign-name"), 
        page = Page.homePage(pageLocation = "screenName") 
    ) 
    if (chooseResult.status == ResultStatus.SUCCESS) { 
        chooseResult.choices?.firstOrNull { it.name == "campaign-name" }?.variations?.firstOrNull() 
            ?.let { variation -> 
                //Assuming there is only one variation 
                var resultReportClick = variation.reportClick( 
                    branchId = "example-branch-id", //Optional 
                    dayPart = DayPart.DINNER //Optional 
                ) 
                when (resultReportClick.status) { 
                    ResultStatus.SUCCESS -> TODO() //handle success 
                    ResultStatus.ERROR -> TODO()// handle errors 
                    ResultStatus.WARNING -> TODO() //handle warnings 
                } 
               
            } 
    } 
} 
```

### Reporting slot clicks

> Relevant only for recommendations campaigns.

You can report a click or an impression for a slot using the `Choice.RecsVariation.PayLoad.Data.Slot` object.

#### reportClick

Returns [DYResult](https://dy.dev/dy-dev/docs/kotlin-sdk-references#dyresult)

| Parameter | description                                                                        | Data Structure  |
| :-------- | :--------------------------------------------------------------------------------- | :-------------- |
| branchId  | The branch ID (if relevant)                                                        | String? = null  |
| dayPart   | Define the period of the day the request relates to. Relevant only to Restaurants. | dayPart? = null |

**Example**

```kotlin
private suspend fun reportClickBySlot() { 
    var chooseResult = DYSdk.getInstance().chooseVariations( 
        selectorNames = listOf("recs-campaign-name"), 
        page = Page.homePage(pageLocation = "screenName") 
    ) 
    if (chooseResult.status == ResultStatus.SUCCESS) { 
        chooseResult.choices?.firstOrNull { it.name == "recs-campaign-name" }?.variations?.firstOrNull() 
            ?.let { recsCampaign -> 
                (recsCampaign.payload as? RecsPayload)?.data?.slots?.firstOrNull() 
                    ?.let { slot -> 
                        var result = slot.reportClick( 
                            branchId = "example-branch-id", //Optional 
                            dayPart = DayPart.DINNER //Optional
                        ) 
                        when (result.status) { 
                            ResultStatus.SUCCESS -> TODO() //handle success 
                            ResultStatus.ERROR -> TODO()// handle errors 
                            ResultStatus.WARNING -> TODO() //handle warnings 
                        } 
                    } 
            } 
    } 
} 
```

### Reporting slot impressions

You can report an impression for one or more slots using the `StoreRecsVariation` object.

> Relevant only for Restaurant recommendations campaigns.

| Parameter | Description                                                                        | Data Structure      |
| :-------- | :--------------------------------------------------------------------------------- | :------------------ |
| SlotIds   | The IDs of the slots to report an impression for                                   | List<Sting>? = null |
| branchId  | The ID of the branch the recommendation is for                                     | String? = null      |
| dayPart   | Define the period of the day the request relates to. Relevant only to Restaurants. | dayPart? = null     |

**Example**

```kotlin
private suspend fun reportClickStoreRecsVariation() { 
    var chooseResult = DYSdk.getInstance().chooseVariations( 
        selectorNames = listOf("store-recs-campaign-name"), 
        page = Page.homePage(pageLocation = "screenName") 
    ) 
    if (chooseResult.status == ResultStatus.SUCCESS) { 
        (chooseResult.choices?.firstOrNull { it.name == "store-recs-campaign-name" }?.variations?.firstOrNull() as? StoreRecsVariation)?.let { storeRecsVariation -> 
            var slotsId = 
                (storeRecsVariation.payload as? StoreRecsPayload)?.data?.slots?.map { it.slotId } 
            slotsId?.let { 
                //Assuming there is only one variation 
                var resultReportClick = storeRecsVariation.reportSlotsImpression( 
                    slotsIds = slotsId, 
                    branchId = "example-branch-id", //Optional 
                    dayPart = DayPart.DINNER //Optional 
                ) 
                when (resultReportClick.status) { 
                    ResultStatus.SUCCESS -> TODO() //handle success 
                    ResultStatus.ERROR -> TODO()// handle errors 
                    ResultStatus.WARNING -> TODO() //handle warnings 
                } 
            } 
        } 
    } 
} 
```

## Using the DYSdk Object

You can also report engagement using the DYSdk object.

### reportImpression

Returns [DYResult](https://dy.dev/dy-dev/docs/kotlin-sdk-references#dyresult)

| Parameter  | Description                                                                        | Data Structure    |
| :--------- | :--------------------------------------------------------------------------------- | :---------------- |
| decisionId | A unique decision ID received in the Choose Variations call                        | String            |
| variations | The variation ID                                                                   | List<Int>? = null |
| branchId   | The ID of the branch the recommendation is for                                     | String? = null    |
| dayPart    | Define the period of the day the request relates to. Relevant only to Restaurants. | dayPart? = null   |

**Example**

```kotlin
private suspend fun reportImpression() { 
    var result = DYSdk.getInstance().engagements.reportImpression( 
        decisionId = "decisionId", 
        variations = listOf(123,456,789), // optional 
        dayPart = DayPart.DINNER,// optional 
        branchId = "example-branch-id" // optional 
    ) 
 
    when (result.status) { 
        ResultStatus.SUCCESS -> TODO() 
        ResultStatus.ERROR -> TODO() 
        ResultStatus.WARNING -> TODO() 
    } 
} 
```

> **Note**: If you previously sent a Choose Variations request with `isImplicitImpressionMode` set to `true`, do not report impressions for the returned variations. Reporting them will result in duplicate impressions being counted.

### reportClick

Returns [DYResult](https://dy.dev/dy-dev/docs/kotlin-sdk-references#dyresult)

| Parameter  | Description                                                                        | Data Structure  |
| :--------- | :--------------------------------------------------------------------------------- | :-------------- |
| decisionId | A unique decision ID received in the Choose Variations call                        | String          |
| variation  | The variation ID                                                                   | Int? = null     |
| branchId   | The ID of the branch the recommendation is for                                     | String? = null  |
| dayPart    | Define the period of the day the request relates to. Relevant only to Restaurants. | dayPart? = null |

**Example**

```kotlin
private suspend fun reportClick() { 
    var result = DYSdk.getInstance().engagements.reportClick( 
        decisionId = "decisionId", 
        variation = 1234, // optional 
        dayPart = DayPart.DINNER,// optional 
        branchId = "example-branch-id" // optional 
    ) 
 
    when (result.status) { 
        ResultStatus.SUCCESS -> TODO() 
        ResultStatus.ERROR -> TODO() 
        ResultStatus.WARNING -> TODO() 
    } 
} 
 
```

### reportSlotClick

Returns [DYResult](https://dy.dev/dy-dev/docs/kotlin-sdk-references#dyresult)

[block:parameters]
{
  "data": {
    "h-0": "Parameter",
    "h-1": "Description",
    "h-2": "Data Structure",
    "0-0": "slotId <br><span style=\"color:gray; font-size:0.8em;\"><strong>Required</strong></span>",
    "0-1": "The slotId as returned from the Choose Variations call. Do not use for API custom code campaigns.",
    "0-2": "String",
    "1-0": "variationId",
    "1-1": "The variation ID",
    "1-2": "Int? = null",
    "2-0": "branchId",
    "2-1": "The ID of the branch the recommendation is for",
    "2-2": "String? = null",
    "3-0": "dayPart",
    "3-1": "Define the period of the day the request relates to. Relevant only to Restaurants.",
    "3-2": "dayPart? = null"
  },
  "cols": 3,
  "rows": 4,
  "align": [
    "left",
    "left",
    "left"
  ]
}
[/block]

**Example**

```kotlin
private suspend fun reportSlotClick() { 
    var result = DYSdk.getInstance().engagements.reportSlotClick( 
        variation = 123,// optional 
        slotId = "slot-id",  
       dayPart = DayPart.DINNER,// optional 
        branchId = "example-branch-id" // optional 
    ) 
 
    when (result.status) { 
        ResultStatus.SUCCESS -> TODO() 
        ResultStatus.ERROR -> TODO() 
        ResultStatus.WARNING -> TODO() 
    } 
} 
```

### reportSlotImpression

> For Restaurant Recommendations campaigns.

Returns [DYResult](https://dy.dev/dy-dev/docs/kotlin-sdk-references#dyresult)

[block:parameters]
{
  "data": {
    "h-0": "Parameter",
    "h-1": "Description",
    "h-2": "Data Structure",
    "0-0": "slotIds<br><span style=\"color:gray; font-size:0.8em;\"><strong>Required</strong></span>",
    "0-1": "The slotId as returned from the Choose Variations call. Do not use for API Custom Code campaigns.",
    "0-2": "List\\<String\\>",
    "1-0": "variationId",
    "1-1": "The variation ID",
    "1-2": "List\\<Int\\>? = null",
    "2-0": "branchId",
    "2-1": "The ID of the branch the recommendation is for",
    "2-2": "String? = null",
    "3-0": "dayPart",
    "3-1": "Define the period of the day the request relates to. Relevant only to Restaurants.",
    "3-2": "dayPart? = null"
  },
  "cols": 3,
  "rows": 4,
  "align": [
    "left",
    "left",
    "left"
  ]
}
[/block]

**Example**

```kotlin
private suspend fun reportSlotsImpression() { 
    var result = DYSdk.getInstance().engagements.reportSlotsImpression( 
        variation = 123,// optional 
        slotsIds = listOf("slot-id-1","slot-id-2"), 
        dayPart = DayPart.DINNER,// optional 
        branchId = "example-branch-id" // optional 
    ) 
 
    when (result.status) { 
        ResultStatus.SUCCESS -> TODO() 
        ResultStatus.ERROR -> TODO() 
        ResultStatus.WARNING -> TODO() 
    } 
} 
```

### reportPnEngagement

> For App Push Notification campaigns

Returns [DYResult](https://dy.dev/dy-dev/docs/kotlin-sdk-references#dyresult)

[block:parameters]
{
  "data": {
    "h-0": "Parameter",
    "h-1": "Description",
    "h-2": "Data Structure",
    "0-0": "trackingData <br><span style=\"color:gray; font-size:0.8em;\"><strong>Required</strong></span>",
    "0-1": "Enables Dynamic Yield to track actions attributable to the push notification. Must be extracted from the messaging provider. Learn more about the [tracking link variable](https://support.dynamicyield.com/hc/en-us/articles/13472246286749-Create-a-Reconnect-Campaign#trackinglink).",
    "0-2": "trackingData",
    "1-0": "trackingData.rri",
    "1-1": "",
    "1-2": "String? = null",
    "2-0": "trackingData.sectionID",
    "2-1": "",
    "2-2": "String? = null",
    "3-0": "trackingData.userID",
    "3-1": "",
    "3-2": "String? = null",
    "4-0": "trackingData.reqTs",
    "4-1": "",
    "4-2": "String? = null",
    "5-0": "trackingData.version",
    "5-1": "",
    "5-2": "String? = null",
    "6-0": "trackingData.events**(required)**",
    "6-1": "",
    "6-2": "list<trackingDataEvent>",
    "7-0": "trackingDataeEvent.ver",
    "7-1": "",
    "7-2": "String? = null",
    "8-0": "trackingDataeEvent.expVisitId",
    "8-1": "",
    "8-2": "String? = null",
    "9-0": "trackingDataeEvent.smech",
    "9-1": "",
    "9-2": "String? = null",
    "10-0": "trackingDataeEvent.vars",
    "10-1": "",
    "10-2": "List<Int>? = nulll",
    "11-0": "trackingDataeEvent.exp",
    "11-1": "",
    "11-2": "String? = null",
    "12-0": "trackingDataeEvent.mech",
    "12-1": "",
    "12-2": "String? = null"
  },
  "cols": 3,
  "rows": 13,
  "align": [
    "left",
    "left",
    "left"
  ]
}
[/block]

```kotlin
private suspend fun reportPnEngagement() { 
    var result = DYSdk.getInstance().engagements.reportPnEngagement(  
        trackingData = TrackingData( 
            rri = "rri", sectionID = "sectionId", 
            reqTs = "reqTs", userID = "userId", version = "version", 
            events = listOf( 
                TrackingDataEvent( 
                    ver = "ver", 
                    expVisitId = "expVisitId", 
                    smech = "smech", 
                    vars = listOf(1, 2, 3), 
                    exp = "exp", 
                    mech = "mech" 
                ) 
            ) 
        ) 
    ) 
    when (result.status) { 
        ResultStatus.SUCCESS -> TODO() 
        ResultStatus.ERROR -> TODO() 
        ResultStatus.WARNING -> TODO() 
    } 
}
```