> For the complete documentation index, see [llms.txt](https://help.branch.io/llms.txt).

# Enable MediaMath (New)

> Connect MediaMath to Branch to attribute clicks and installs on programmatic demand-side platform campaigns.

## Overview

[MediaMath](https://infillion.com/products/infillion-platform/) is a demand-side platform (DSP) whose platform is now operated by Infillion as Infillion MediaMath. Connect MediaMath to Branch to attribute clicks and installs and configure Postbacks.

For more information about integrating ad partners in general, visit our [Ad Partner Integration Guide](https://help.branch.io/marketer-hub/ad-partner-integration-guide-new.md).

> **Note: this guide is for new Branch**
>
> Please note that this guide is about integrating MediaMath in the [new Branch experience](https://help.branch.io/marketer-hub/new-branch-overview.md). For information on MediaMath in legacy Branch, visit our [legacy guide](https://help.branch.io/marketer-hub/mediamath.md).

### Partner capabilities

| Capability | Details |
| --- | --- |
| Company type | DSP |
| Deep linking | Contact MediaMath for details. |
| Attribution | Contact MediaMath for details. |
| Ad campaign types | Contact MediaMath for details. |
| Ad formats | Contact MediaMath for details. |
| Click types | Contact MediaMath for details. |
| Supported platforms | Contact MediaMath for details. |
| Link wrapping | Contact MediaMath for details. |
| Cost ingestion support | Contact MediaMath for details. |
| Pricing models | Contact MediaMath for details. |

## Before you begin

To set up the MediaMath integration, you need:

- Ad partner integrations enabled for your Branch account. Availability varies by Branch plan. See [Branch pricing](https://www.branch.io/pricing/) or contact your Branch representative.
- A Branch account with access to **Configuration > Ad Partners** and admin permissions to enable and configure integrations.
- A MediaMath account with admin access. You'll need the following credential, available from your MediaMath account manager: MediaMath Advertiser ID.
- [PAM](https://help.branch.io/marketer-hub/predictive-aggregate-measurement.md) enabled (recommended).

> **Note: PAM uses two separate toggles**
>
> The **PAM for Publishers** toggle for this partner, found under **Partner settings** > **Manage account**, is separate from the account-level **PAM switch**. **PAM for Publishers** must be enabled to reconcile conversion events with your partner. To attribute events with PAM, you also need PAM enabled on the [Attribution page](https://help.branch.io/account-hub/attribution-page-new.md) under **Configuration** > **Attribution**. Learn more in our [PAM Overview](https://help.branch.io/marketer-hub/predictive-aggregate-measurement.md#pam-for-publishers).

## Enable MediaMath

To begin, navigate to **Configuration > Ad Partners > MediaMath**.

Enter your **MediaMath Advertiser ID**, then select **Enable MediaMath** on the MediaMath page. Contact your MediaMath account manager if you need this value.

## Configure attribution

To configure attribution windows, select the **Attribution windows** tab on the MediaMath page.

To minimize discrepancies when comparing Branch and MediaMath reporting, match your Branch attribution windows to the settings in your MediaMath account.

| Attribution type | Default | MediaMath's recommendation |
| --- | --- | --- |
| Click to start session | 1 day | 90 days |
| Click to install | 7 days | 30 days |
| Click to conversion event | 30 days | 90 days |
| Impression to start session | 1 day | 1 day |
| Impression to install | 1 day | 1 day |
| Impression to conversion event | 7 days | 1 day |
| Deep linking duration | 120 minutes | — |

For more information, follow [Configure attribution](https://help.branch.io/marketer-hub/ad-partner-integration-guide-new.md#configure-attribution) in the general [Ad Partner Integration Guide](https://help.branch.io/marketer-hub/ad-partner-integration-guide-new.md).

## Configure postbacks

Enabling MediaMath automatically activates postbacks for `INSTALL`. The default postback URL template is:

```
https://pixel-s2s.mathtag.com/event/img?mt_id=${(ad_network.goal_ids["${(name)!}"])!}&mt_adid=${ (ad_network.credentials.mt_adid)! }&mt_uuid=${ (last_attributed_touch_data.~click_id)! }&auction_id=${ (last_attributed_touch_data.auction_id)! }&os_name=${ (user_data.os)! }&os_version=${ (user_data.os_version)! }&device_model=${ (user_data.model)! }&country=${ (user_data.geo_country_code)! }&device_id=<#if (user_data.os)! == "IOS" && (user_data.idfa)! != "">${(user_data.idfa)!}<#elseif (user_data.os)! == "IOS">${(user_data.idfv)!}<#elseif (user_data.os)! == "ANDROID">${(user_data.aaid)!}</#if>&product_id=${(custom_data.product_id)!}&product_name=${(commerce_data.name)!}&product_category=${(commerce_data.category)!}&product_brand=${(commerce_data.brand)!}&product_price=${(commerce_data.price)!}&product_quantity=${(commerce_data.quantity)!}&revenue=${ (event_data.revenue)! }&currency=${ (event_data.currency)! }&ip_address=${ (user_data.ip)! }&campaign_id=${ (last_attributed_touch_data.~campaign_id)! }&secondary_publisher=${ (last_attributed_touch_data.~secondary_publisher)! }&creative_id=${ (last_attributed_touch_data.~creative_id)! }&strategy=${ (last_attributed_touch_data.AD_ATTR.strategy)! }&conversion_timestamp=${ (timestamp/1000)?long }&mmp=branch&v1=${ (event_data.revenue)! }&v2=${ (event_data.currency)! }&attribution_source=<#if (last_attributed_touch_data.$3p)! == (ad_network.machine_name)!>1<#else>0</#if>&mobile_user_agent=${ (user_data.user_agent)! }&limit_ad_tracking=<#if (user_data.limit_ad_tracking)! >1<#else>0</#if>&ex_placement_id=${(last_attributed_touch_data.~placement_id)!}
```

To add postbacks for additional events or to customize behavior, follow [Configure postbacks](https://help.branch.io/marketer-hub/ad-partner-integration-guide-new.md#configure-postbacks) in the general [Ad Partner Integration Guide](https://help.branch.io/marketer-hub/ad-partner-integration-guide-new.md).

## Create a Branch Ad Link

Create a Branch Ad Link to use in your MediaMath campaigns. Branch uses the link to attribute clicks and deep link users into your app.

Follow [Create Ad Links](https://help.branch.io/marketer-hub/ad-links-new.md).

## Verify your data

After your integration is connected and events are flowing, you can verify data is reaching Branch:

- **In Branch** [**Liveview**](https://app.branch.io/testing-and-monitoring/events): confirm that events from your app appear in real time. This is the fastest way to confirm SDK events are firing.
- **In Branch** [**Analysis dashboards**](https://help.branch.io/marketer-hub/analysis-data-sources-new.md): review attributed installs and events where `Ad Partner Name = MediaMath`.
- **In MediaMath**: confirm that forwarded events are appearing in your MediaMath attribution reporting.

## Data mappings

### Campaign data

Branch populates the following fields from MediaMath campaign data.

| Branch field | Partner data |
| --- | --- |
| `~advertising_partner_name` | `"MediaMath"` (static) |
