> ## 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.

# Amplitude Audiences

## Introduction

[Amplitude](https://amplitude.com/) enables you to drive growth through robust product and behavioral analytics. Gain a thorough understanding of exactly what behaviors and traits are common among user segments to inform powerful targeting.

<Note>
  The Amplitude audience integration does not currently support [Unified Identity](https://moengage-user-guide.mintlify.app/user-guide/data/user-data/unified-identity-identity-resolution) or [Portfolio](https://moengage-user-guide.mintlify.app/user-guide/settings/account/portfolio/portfolio).
</Note>

## Scope

* Enable deeper behavioral and product analysis with MoEngage and Amplitude.
* Gauge the efficacy of segmentation and experimentation on the customer experience through Amplitude and send personalized messages through MoEngage.
* Export behavioral cohorts directly from Amplitude to MoEngage or utilize Streams to export data from MoEngage to Amplitude.

## Benefits and Use Cases

The following use-cases provide integration value addition to your analytics + user engagement activities:

### E-commerce

Understand the seasonal changes in purchase trends that are happening and send rich push notifications to such users using MoEngage. For example, target the cohort of users who purchase high-value items during summers and send rich push notifications with similar recommended items.

### Travel

You can create a cohort in Amplitude of millennial users who are also premium users of your app and send them popular and unique holiday destination recommendations using MoEngage emails.

## Steps

<Info>
  **Prerequisites**

  * Ensure you have Amplitude account credentials. To enable the cohort sync integration, contact Amplitude.
  * Ensure you have the MoEngage account credentials.
</Info>

### Enabling Amplitude and MoEngage Integration for your account

1. For enabling the cohort sync integration, please reach out to Amplitude and get this enabled for your account.
2. Once you have the integration enabled for your Amplitude account, you will be able to configure MoEngage as a destination in Amplitude. See the below steps for setting this up.
3. To enable the data export integration from MoEngage to Amplitude, please contact your MoEngage customer success manager (CSM) or the MoEngage Support team with a few details mentioned in Exporting Campaign Data from MoEngage to Amplitude.

### Setting up MoEngage as a destination on Amplitude

To setup MoEngage as a destination on Amplitude, follow the below steps:

1. Log in to Amplitude and Navigate to **Sources and Destinations**. <img src="https://mintcdn.com/moengage/0EdW-QMnfbsLxXT2/images/partner_6391038683284.png?fit=max&auto=format&n=0EdW-QMnfbsLxXT2&q=85&s=e30cfb57655be525618ea68c027d3a4a" alt="Amplitude Sources and Destinations page" width="1437" height="801" data-path="images/partner_6391038683284.png" />
2. On the **Sources & Destinations** page, go to **Destinations** and click on **Add Destination** > **MoEngage**. On doing this, you will see a pop-up with the following details: <img src="https://mintcdn.com/moengage/0EdW-QMnfbsLxXT2/images/partner_6391025308308.png?fit=max&auto=format&n=0EdW-QMnfbsLxXT2&q=85&s=9f925523848c2601b2d8d33befb15095" alt="Add MoEngage as a destination popup in Amplitude" width="514" height="649" data-path="images/partner_6391025308308.png" />
3. Log in to your MoEngage Dashboard and navigate to **Settings** to get the Workspace ID and Secret Key.
   <Info>
     Acquisition Settings are available in **Settings** > **Analytics** > **Acquisition tracking**.
   </Info>
   1. Navigate to **Settings** > **Account** > **APIs**.
   2. Click on the copy icon to copy the Workspace ID.
   3. Click on the copy icon in the **Data** tile in the **API Keys** section to copy the Secret Key. <img src="https://mintcdn.com/moengage/7iGV38YjgdBKSU0B/images/partner_22181763389844.png?fit=max&auto=format&n=7iGV38YjgdBKSU0B&q=85&s=be9df384c39a94d18cd9f5b6e45e23fd" alt="MoEngage Settings APIs page showing Workspace ID and Data API key" width="1866" height="1358" data-path="images/partner_22181763389844.png" />
4. The Attribute Mapping is as follows:
   * **User Id** - This will be the primary key to map a user between Amplitude and MoEngage. Please ensure that you are identifying users with the same unique user id in both Amplitude and MoEngage.
   * **moe\_anonymous\_id**: This will be the secondary identifier that will be used to map users between Amplitude and MoEngage and will be essential to map the anonymous users between Amplitude and MoEngage. Please ensure that you are setting `moe_anonymous_id` as a user attribute in MoEngage and the attribute selection made on the Amplitude dashboard and `moe_anonymous_id` in MoEngage have the same value so that the mapping is possible.
5. Complete the Destination Setup.

After everything is configured on the Amplitude dashboard, click **Save** to add MoEngage as a destination.

## Exporting Cohorts from Amplitude to MoEngage

<Note>
  Ensure your cohort name does not start with a period (.) and must not contain the following restricted characters: `|`, `*`, `?`, `\`, `:`, `<`, `>`, `=`, `$`, `"`.
</Note>

To export specific behavioral cohorts from Amplitude to MoEngage, please follow the below steps:

1. Open a cohort in Amplitude that you want to sync with MoEngage and click **Sync To** > Select **MoEngage**. <img src="https://mintcdn.com/moengage/0EdW-QMnfbsLxXT2/images/partner_6391046166932.png?fit=max&auto=format&n=0EdW-QMnfbsLxXT2&q=85&s=ff76eab4240cbbbc71f2f8e21548a05e" alt="Amplitude cohort sync to MoEngage option" width="1183" height="608" data-path="images/partner_6391046166932.png" /> The **Sync your cohort to MoEngage** pop-up is displayed. <img src="https://mintcdn.com/moengage/V7W8fvZbxtTmKTAn/images/partner_11619075291796.png?fit=max&auto=format&n=V7W8fvZbxtTmKTAn&q=85&s=7ea77932c01f914a8add1fcb670aca26" alt="Sync your cohort to MoEngage popup with sync options" width="2320" height="1204" data-path="images/partner_11619075291796.png" />
2. Select one of the following:
   * **One-Time Sync**: This will only send the users under the cohort to MoEngage once and the cohort will not sync thereafter.
   * **Scheduled Sync**: This option will ensure that the updated information of the cohorts like the new users who qualify for this cohort and the existing users who are removed from the cohort are sent to MoEngage every hour or day.
   * **Near Real Time Sync**: This option will ensure that the updated information of the cohorts like the new users who qualify for this cohort and the existing users who are removed from the cohort are sent to MoEngage every minute.

<Warning>
  Users in your Amplitude cohort attempted to map with unique user profiles in MoEngage. If MoEngage systems do not have that user profile, the user is not mapped and not added to the cohort/segment.

  In this scenario, you may find fewer users in the MoEngage cohort compared to the Amplitude cohort. Make sure you have all users in MoEngage before you perform the cohort sync.
</Warning>

### Using Cohorts in MoEngage Campaigns

After the sync, the cohort is available as a custom segment in MoEngage as described:

<img src="https://mintcdn.com/moengage/0EdW-QMnfbsLxXT2/images/partner_6391019524756.png?fit=max&auto=format&n=0EdW-QMnfbsLxXT2&q=85&s=e2e1c243b6f79818d02cb93274b858bf" alt="Amplitude cohort appearing as a custom segment in MoEngage" width="1194" height="549" data-path="images/partner_6391019524756.png" />

The custom segment is used in any MoEngage campaigns to send personalized messages to the users under this segment.

## Exporting Campaign Data from MoEngage to Amplitude

<Info>
  **Prerequisites**

  Exports to Amplitude make use of MoEngage Streams, which is an add-on.
</Info>

To setup exports to Amplitude, go to **MoEngage Dashboard** > **App Marketplace**. Search for Amplitude and go to the **Integrate** tab.

<img src="https://mintcdn.com/moengage/W4UIG2ZYu1ajYKNS/images/partner_13910721832212.png?fit=max&auto=format&n=W4UIG2ZYu1ajYKNS&q=85&s=f4439394872e2e85a42d29d377bf0234" alt="Amplitude integration tile in the MoEngage App Marketplace" width="2880" height="1416" data-path="images/partner_13910721832212.png" />

1. Click on **+ Add Integration**.
2. Fill up the form: Amplitude API Key - This is available on your **Amplitude Account** > **Settings** > **ProjectName** > **General** > **API Key** as shown below: <img src="https://mintcdn.com/moengage/0EdW-QMnfbsLxXT2/images/partner_6391019543316.png?fit=max&auto=format&n=0EdW-QMnfbsLxXT2&q=85&s=01b259f123cccaba3ec385577f7203c8" alt="Amplitude project settings page showing the API Key" width="2872" height="936" data-path="images/partner_6391019543316.png" />
3. Select the events you want to forward and select a Data Residency.
4. Click on **Connect**.

All the events sent by MoEngage are displayed in Amplitude by filtering basis `$source = MOENGAGE`. These events are sent to Amplitude in near real-time and will rely on the common user identifier between Amplitude and MoEngage for user identification.

The following MoEngage source-specific documents for setting unique user id in MoEngage:

* [Android](https://www.moengage.com/docs/developer-guide/android-sdk/data-tracking/basic/track-user-attributes)
* [iOS](https://www.moengage.com/docs/developer-guide/ios-sdk/data-tracking/basic/tracking-user-attributes)
* [Web](https://www.moengage.com/docs/developer-guide/web-sdk/data-tracking/web-sdk-user-attributes-tracking)
* [Data API (Server-side integration)](https://www.moengage.com/docs/api/data/data-overview)

<Info>
  Ensure that you are setting the same value for User Id in Amplitude and Unique User Id in MoEngage.
</Info>

## Rate Limits

To maintain platform stability, MoEngage limits ingestion of Amplitude data to a maximum of 500 requests per second (RPS) per workspace. If your workspace exceeds this limit, MoEngage returns an HTTP `429 (Too Many Requests)` status code.

Refer to Amplitude's default retry policy to understand how rate limiting affects your data flow.

**Retry Exhaustion**: If Amplitude exhausts all retry attempts for a batch of data, you must contact the Amplitude Support Team to replay the failed requests.

### Export Data

The following data points are sent by default to Amplitude:

| Event Name                                      | Event Code                                       | Type (Reference Only) | Channel             | Description                                                                                                                          |
| ----------------------------------------------- | ------------------------------------------------ | --------------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| Card Sent                                       | `n_c_s`                                          | Delivery              | Cards               | Tracked when a Card notification is sent to the user, doesn't indicate if the notification is delivered to the App Inbox             |
| Card Delivered                                  | `MOE_CARD_CAMPAIGN_DELIVERED`                    | Delivery              | Cards               | Tracked when a Card is delivered to the App Inbox after the user has opened the Inbox                                                |
| Card Viewed                                     | `MOE_CARD_CAMPAIGN_VIEWED`                       | Delivery              | Cards               | Tracked when the user views a Card or scrolls down to it in the App Inbox                                                            |
| Card Clicked                                    | `MOE_CARD_CAMPAIGN_CLICKED`                      | Interaction           | Cards               | Tracked when the user clicks the Card in the App Inbox                                                                               |
| Connector Sent                                  | `MOE_CONNECTOR_SENT`                             | Delivery              | Connector           | Tracked when a connector was sent successfully.                                                                                      |
| Email Sent                                      | `MOE_EMAIL_SENT`                                 | Delivery              | Email               | Tracked when our system sends an email to a user.                                                                                    |
| Email Deferred                                  | `MOE_EMAIL_DEFERRED`                             | Delivery              | Email               | Tracked when the receiving server is unable to accept your request, email sending will be re-tried in this case                      |
| Email Delivered                                 | `MOE_EMAIL_DELIVERED`                            | Delivery              | Email               | Tracked when an email is delivered in an inbox                                                                                       |
| Email Dropped                                   | `MOE_EMAIL_DROP`                                 | Delivery              | Email               | Tracked when a user opens an email.                                                                                                  |
| Email Bounced                                   | `MOE_EMAIL_HARD_BOUNCE`                          | Delivery              | Email               | Tracked when a user clicks on any link in the email.                                                                                 |
| Email Soft Bounced                              | `MOE_EMAIL_SOFT_BOUNCE`                          | Delivery              | Email               | Tracked when an email is dropped. Email is dropped when it's part of the bounce list, the unsubscribe list, or the spam report list. |
| Email Opened                                    | `MOE_EMAIL_OPEN`                                 | Interaction           | Email               | Tracked when our system finds an email is soft bounced. Typically happens when there is a temporary delivery issue.                  |
| Email Clicked                                   | `MOE_EMAIL_CLICK`                                | Interaction           | Email               | Tracked when our system finds an email is hard bounced. Typically happens when an email address doesn't exist.                       |
| Email Unsubscribed                              | `MOE_EMAIL_UNSUBSCRIBE`                          | Interaction           | Email               | Tracked when a user marks the email as spam.                                                                                         |
| Email Spam Complained                           | `MOE_EMAIL_SPAM`                                 | Interaction           | Email               | Tracked when a user unsubscribes from receiving emails.                                                                              |
| In-App Shown Android                            | `IN_APP_SHOWN`                                   | Interaction           | In-App              | Tracked when an In-App message is shown to the user on an Android device.                                                            |
| In-App Clicked Android                          | `IN_APP_CLICKED`                                 | Interaction           | In-App              | Tracked when a user clicks In-App message on an Android device.                                                                      |
| In-App Closed Android                           | `IN_APP_CLOSE_CLICKED`                           | Interaction           | In-App              | Tracked when a user dismisses an In-App message by clicking on the close button on an Android device.                                |
| In-App Shown iOS                                | `iOS_IN_APP_SHOWN`                               | Interaction           | In-App              | Tracked when an In-App message is shown to the user on an iOS device.                                                                |
| In-App Clicked iOS                              | `iOS_IN_APP_CLICKED`                             | Interaction           | In-App              | Tracked when a user clicks In-App message on an iOS device.                                                                          |
| In-App Closed iOS                               | `iOS_IN_APP_CLOSE_CLICKED`                       | Interaction           | In-App              | Tracked when a user dismisses an In-App message by clicking on the close button on an iOS device.                                    |
| Mobile In-App Shown                             | `MOE_IN_APP_SHOWN`                               | Interaction           | In-App V3           | Tracked when a user is shown an in-app version 3 campaign                                                                            |
| Mobile In-App Clicked                           | `MOE_IN_APP_CLICKED`                             | Interaction           | In-App V3           | Tracked when a user clicks an in-app version 3 campaign                                                                              |
| Mobile In-App Dismissed                         | `MOE_IN_APP_DISMISSED`                           | Interaction           | In-App V3           | Tracked when a user closes an in-app version 3 campaign                                                                              |
| Notification Received Android                   | `NOTIFICATION_RECEIVED_MOE`                      | Delivery              | Push                | Tracked when a user receives a notification on an Android device.                                                                    |
| Notification Clicked Android                    | `NOTIFICATION_CLICKED_MOE`                       | Interaction           | Push                | Tracked when a user clicks notification on an Android device.                                                                        |
| Notification Sent iOS                           | `n_i_s`                                          | Delivery              | Push                | Tracked when a user receives a notification on an iOS device.                                                                        |
| Notification Received iOS                       | `NOTIFICATION_RECEIVED_IOS_MOE`                  | Delivery              | Push                | Tracked when App in foreground and user receives the notification on iOS.                                                            |
| Notification Clicked iOS                        | `NOTIFICATION_CLICKED_IOS_MOE`                   | Interaction           | Push                | Tracked when a user clicks notification on an iOS device.                                                                            |
| Notification Received Web                       | `NOTIFICATION_RECEIVED_WEB_MOE`                  | Delivery              | Push                | Tracked when a user receives a notification on a browser.                                                                            |
| Notification Clicked Web                        | `NOTIFICATION_CLICKED_WEB_MOE`                   | Interaction           | Push                | Tracked when a user clicks notification on the browser.                                                                              |
| On-site Message Shown                           | `MOE_ONSITE_MESSAGE_SHOWN`                       | Interaction           | On-site             | Tracked when an on-site messaging campaign is shown to a user                                                                        |
| On-site Message Clicked                         | `MOE_ONSITE_MESSAGE_CLICKED`                     | Interaction           | On-site             | Tracked when an on-site messaging campaign is clicked by a user                                                                      |
| On-site Message Closed                          | `MOE_ONSITE_MESSAGE_CLOSED`                      | Interaction           | On-site             | Tracked when an on-site messaging campaign is closed by a user                                                                       |
| Web Personalization Message Shown               | `MOE_WEBP_MESSAGE_SHOWN`                         | Interaction           | Web Personalization | Tracked when a web personalization campaign is shown to a user                                                                       |
| Web Personalization Message Clicked             | `MOE_WEBP_MESSAGE_CLICKED`                       | Interaction           | Web Personalization | Tracked when a web personalization campaign is clicked by a user                                                                     |
| Web Personalization Message Closed              | `MOE_WEBP_MESSAGE_CLOSED`                        | Interaction           | Web Personalization | Tracked when a web personalization campaign is closed by a user                                                                      |
| SMS Sent                                        | `SMS_SENT`                                       | Delivery              | SMS                 | Tracked when our system sends SMS to a user.                                                                                         |
| SMS Delivered                                   | `SMS_DELIVERED`                                  | Delivery              | SMS                 | Tracked when our system receives a delivery receipt for the SMS sent to a user.                                                      |
| User Entered Flow                               | `USER_ENTERED_FLOW`                              | Delivery              | Flows               | Tracked when a user falls in the target audience and has qualified for the entry in the Flow.                                        |
| User Exited Flow                                | `USER_EXITED_FLOW`                               | Delivery              | Flows               | Tracked when a user exits from a Stop Cell of the Flow.                                                                              |
| User Added To Control Group                     | `MOE_CAMPAIGN_CONTROL_GROUP`                     | Delivery              | All Campaigns       | Tracked when a user is added to a control group                                                                                      |
| User Removed From Control Group                 | `MOE_USER_REMOVED_FROM_CONTROL_GROUP`            | Delivery              | All Campaigns       | Tracked when a user is removed from a control group                                                                                  |
| User Removed From Campaign Due to Control Group | `MOE_CAMPAIGN_USER_REMOVED_DUE_TO_CONTROL_GROUP` | Delivery              | All Campaigns       | Tracked when a user is removed from a campaign due to the user being a part of the control group                                     |

<Warning>
  **Points to remember for events sent to Amplitude**

  * All events sent to Amplitude have UID by default. This captures the value of the ID which is present in a unique user profile in MoEngage. If present, this will be used to match a user on Amplitude basis the User Id present in the Amplitude user profile.
  * All campaign events have `campaign_id`, `campaign_name`, `campaign_type`, `campaign_channel` by default.
  * All campaign events having attribute `moe_anonymous_id` in the corresponding user profile for whom the event is tracked are sent to Amplitude as `device_id` key.
  * Events for users who do not have a unique user ID or `moe_anonymous_id` set for their user profile in MoEngage are dropped by Amplitude.
  * All email campaign events have email\_id as `moe_email_id` by default.
  * All push campaign events have push\_id as `moe_push_id` by default.
  * All SMS campaign events have a mobile number as `moe_mobile_number` by default.
  * All campaign events of the campaign are a part of MoEngage Flows have two additional attributes `parent_flow_id` and `parent_flow_name` are present.
  * All campaigns having multiple variations or locales have the following additional attributes:
    * `variation_id`
    * `locale_id`
    * `locale_name`
  * All events have `moengage_user_id` by default. This is a MoEngage internal user identifier and is populated with each event in MoEngage.
</Warning>

For further assistance, please contact your MoEngage Customer Success Manager (CSM) or the Support team.

## Frequently Asked Questions

<AccordionGroup>
  <Accordion title="Does Data Exports guarantee the latest user attributes?">
    No, Data Exports is primarily built to export your Events in near real-time and user attributes in MoEngage are updated asynchronously so it is currently not possible to guarantee the latest values of user attributes in the exports.
  </Accordion>

  <Accordion title="How soon will I start getting the data?">
    It typically takes up to 30 minutes for the automated data exports to be set up for your account and for you to start seeing data there.
  </Accordion>

  <Accordion title="Can I export additional events at a later time?">
    Yes, if you need to export new events at a later time, you can always edit your configuration on the App Marketplace and get the new events added to your exports.
  </Accordion>

  <Accordion title="Can I export historical data using Automated Data Exports?">
    As of now, you cannot export historical data using Automated Data Exports. Once configured, you will start seeing data for each event from the time you enabled your exports.
  </Accordion>

  <Accordion title="Is there any pricing involved for Automated Data Exports?">
    If your billing plan does not cover this already and you need to get this enabled at a later time, you would need to work with your Customer Success Manager to get this included in your billing plan. Based on the amount of data that MoEngage will place in your Data warehouse/Partner/API on a monthly basis, this could lead to additional charges.
  </Accordion>
</AccordionGroup>
