# How to use In-App interaction event tracking?

{% hint style="info" %}
This guide is specific to Batch's Mobile Engagement Platform (More on the [difference between Batch's CEP and MEP](/getting-started/other/faq/what-are-the-differences-between-batch-customer-engagement-platform-and-mobile-engagement-platform.md)).
{% endhint %}

## Prerequisites <a href="#h_f618af30af" id="h_f618af30af"></a>

### SDK version <a href="#h_9acdcd7bb4" id="h_9acdcd7bb4"></a>

First of all, make sure your app integrates the 1.16 version of the SDK or higher. It includes a built-in action for In-app messages: `batch.user.event`.

### In-app feature <a href="#h_b6720da263" id="h_b6720da263"></a>

The built-in actions are Batch actions associated to a call-to-action of an In-App message, you just need to have the In-App feature enabled to use this feature. When creating an automation, they allow you to set up actions beyond the different actions associated to a button.&#x20;

{% hint style="info" %}
These actions do not require any development and can be **activated directly via the dashboard** when editing the automation.
{% endhint %}

## How to do it? <a href="#h_99b8953218" id="h_99b8953218"></a>

### Creation of automation A: link your buttons to events <a href="#h_bce57149a0" id="h_bce57149a0"></a>

In order to be able to retarget users who have interacted with a previous In-App automation, you need to  track events on your In-App automation A:&#x20;

1. When editing your first In-App automation, you will have to associate your button with an event. To do this, choose the button of your choice (Dismiss, Deeplink, Clipboard, Rating...) then click on "**Add secondary action" > "Track** event".
2. Configure your event: select an already created event or create a new one, you can also add a Label for extra information like the name of the campaign or button.
3. You can also associate your second button, if you have defined one, to another event
4. Your button is now linked to an event (in the example below "Later"), which will be tracked once your users click on it.

<figure><img src="/files/RHhDkNaYnhIP4xvD1qrS" alt=""><figcaption></figcaption></figure>

### Custom event activation <a href="#h_c9b5fe908d" id="h_c9b5fe908d"></a>

Once the first campaign has been sent and the first users have interacted with it, the event you have configured will show up in your custom data. It is necessary to activate it in your **Settings > Custom data** in order to view them on the dashboard when creating the second In-App automation.

### Creation of campaign B: retarget <a href="#h_289d066332" id="h_289d066332"></a>

**Now send a second In-App automation to users who interacted with the In-App automation A**

To do so, you just have to adjust the targeting by choosing exactly the same event defined in campaign A. You will be able to decide to target or exclude the users who interacted with the buttons of your campaign A:&#x20;

<figure><img src="/files/UPfCTxFMo0zMH7D8YEPw" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
To exclude them, just click on the "**Invert**" button.
{% endhint %}

## Use case: retarget users who have not copied a promotional code

Your campaign A could be an In-App message with a promotional code, in the case below, the first button allows the user to copy/paste the code "**PROMO10**" and redirects to the page where the code can be used.

The second button of this In-App message indicating "Maybe later" allows the user to simply close the message. However, this button is in fact linked to an event via the "**Track event**" functionality, so all users who click on "**Maybe later**" will be linked to an event in Batch:&#x20;

<figure><img src="/files/6mFnqKBMlHDkZN7Ir0iH" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/us9kJfMOakGOvp01Kreh" alt=""><figcaption></figcaption></figure>

Below, we see that after clicking on "**Track event**" in order to link an event to the dismiss button "Maybe later", it is necessary to configure this event. You have to name it and give it a label if you want:

<figure><img src="/files/K3lOJG2us6lqnsApgkXD" alt=""><figcaption></figcaption></figure>

Then, in this example, once the event is brought up in Batch following the first clicks of your users on the dismiss button of the In-App message, it will be possible with campaign B to retarget all the users who clicked on "Maybe later" in order to offer them a new (or the same) promotional offer for example!&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.batch.com/guides-and-best-practices/message/in-app-messaging/how-to-use-in-app-interaction-event-tracking.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
