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

# Personalize Experience Events tracking

> Report impression and click events for experiences from the MoEngage Personalize API in your iOS app.

This document outlines the new methods available in the MoEngage iOS SDK to report impressions and clicks for experiences fetched using the [MoEngage Personalize API](https://www.moengage.com/docs/api/experiences/fetch-experience). These methods are currently available only for the **iOS SDK**.

# Prerequisites

## SDK version

<Note>
  You must update your Native iOS SDK version to **10.01.0** or higher.
</Note>

## MoEngage Account Configuration

Ensure your MoEngage workspace is enabled to utilize the Personalize API. Refer to [this article](https://www.moengage.com/docs/user-guide/personalize/server-side-personalization/create-server-side-personalization-experience) for details on setting up Personalize API experiences.

# Reporting Experience Shown events

The SDK provides helper APIs to track shown events, refer the [API documentation](https://moengage.github.io/ios-api-reference/Classes/MoEngageSDKAppPersonalization.html) for more details.

Impressions should be reported when an experience is visually presented to the user.

## Single Experience

To report an impression for a single experience, pass **experienceContext** of the experience as a map.

**experienceContext** is a JSON object that is returned as part of the response [of the Personalize API request](https://www.moengage.com/docs/api/experiences/fetch-experience#response-experiences-additional-properties-experience-context).

<CodeGroup>
  ```swift Swift wrap theme={null}
  MoEngageSDKAppPersonalization.sharedInstance.experienceShown(experienceAttribute: experienceContext)
  ```

  ```objective-c Objective C wrap theme={null}
  [[MoEngageSDKAppPersonalization sharedInstance] experienceShownWithExperienceAttribute:experienceContext];
  ```
</CodeGroup>

## Mulitple Experiences

To track the experience shown event for multiple experiences use, pass the **list** of **experienceContext** of each experience as a map.

<CodeGroup>
  ```swift Swift wrap theme={null}
  MoEngageSDKAppPersonalization.sharedInstance.experienceShown(experienceAttributes: [experienceContext1, experienceContext2, experienceContext3])
  ```

  ```objective-c Objective C wrap theme={null}
  [[MoEngageSDKAppPersonalization sharedInstance] experienceShownWithExperienceAttributes:@[experienceContext1, experienceContext2, experienceContext3]];
  ```
</CodeGroup>

# Reporting Experience Clicked events

The SDK provides helper APIs to track clicked events, refer the [API documentation](https://moengage.github.io/ios-api-reference/Classes/MoEngageSDKPersonalize.html) for more details.

Clicked events should be reported when a user clicks on any element that has been personalized using the response of the Personalize API.

<Warning>
  * When you call `experienceClicked()`, the `experienceAttribute` dictionary must contain both `cid` and `experience` keys. If any key is missing, or the call is made against an un-initialized Workspace ID, the SDK throws a fatal exception and crashes the app in `DEBUG` builds. In Release and TestFlight builds, the click event is dropped silently and logged.
  * If you are upgrading an existing app and these strict `DEBUG` validations cause disruptive crashes while you refactor your tracking code, you can temporarily opt out by calling `disableIntegrationValidator()` during SDK initialization. Use this strictly as a stopgap for phased upgrades, and aim to remove the opt-out once your attribute call sites are properly validated.
</Warning>

## Single Experience

To report a click event for a single experience, pass the **experienceContext** of the experience as a map.

<CodeGroup>
  ```swift Swift wrap theme={null}
  MoEngageSDKAppPersonalization.sharedInstance.experienceClicked(experienceAttribute: experienceContext)
  ```

  ```objective-c Objective C wrap theme={null}
  [[MoEngageSDKAppPersonalization sharedInstance] experienceClickedWithExperienceAttribute:experienceContext];
  ```
</CodeGroup>

## Multiple Experiences

To track the experience shown event for multiple experiences use, pass the **array** of **experienceContext** of each experience as a map.

<CodeGroup>
  ```swift Swift wrap theme={null}
  MoEngageSDKAppPersonalization.sharedInstance.experienceClicked(experienceAttributes: [experienceContext1, experienceContext2, experienceContext3])
  ```

  ```objective-c Objective C wrap theme={null}
  [[MoEngageSDKAppPersonalization sharedInstance] experienceClickedWithExperienceAttributes:@[experienceContext1, experienceContext2, experienceContext3]];
  ```
</CodeGroup>

You can optionally include a **b\_id** key in the **experienceContext** object to provide additional context about the click. Its value should describe the specific component or interaction within the experience that was clicked. This is particularly useful for experiences composed of multiple interactive elements, helping to distinguish between clicks on different parts of the same overall experience.
