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

# How to Send Upstack Attribution to Meta

> Send Meta the purchases Upstack credits to your Meta ads, as AppendAttribution events for a Meta Custom Attribution Source: what you need, the Custom Attribution Source in Events Manager, the setting in Upstack, and how to check it.

## What does Send Upstack Attribution to Meta do?

For each purchase that Upstack credits to your Meta ads, Upstack sends Meta an **AppendAttribution** event. The event names the ad that earned the credit. Meta uses these events in a **Custom Attribution Source** so your campaigns can optimize on Upstack's attribution instead of only Meta's own.

Upstack sends one event per credited purchase. It gives the ad full credit and uses the purchase's value and order ID.

## What do I need to send Upstack attribution to Meta?

* A Meta destination in Upstack with **Server** in its **Tracking Method** and a **Conversion API Key**. See [How to Generate My Facebook Conversion API Key](https://docs.upstackdata.com/destinations/catalog/meta-capi/how-to-generate-my-facebook-conversion-api-key.md).
* Purchase events already reaching that Meta dataset. Meta won't create a Custom Attribution Source without them.
* The ad ID in your Meta ad links. See [How do I add the ad ID to my Meta ad links?](#how-do-i-add-the-ad-id-to-my-meta-ad-links)

## How do I add the ad ID to my Meta ad links?

1. In [Meta Ads Manager](https://adsmanager.facebook.com), open the ad and scroll to **Tracking**.
2. In **URL parameters**, add `utm_content={{ad.id}}`. Keep your other parameters, such as `utm_source=facebook&utm_medium=paid`.
3. Click **Publish**.

Upstack also reads `ad_id={{ad.id}}` if your links use that instead.

## How do I create a Custom Attribution Source in Meta?

1. In [Meta Events Manager](https://business.facebook.com/events_manager), select the dataset your Upstack Meta destination sends to.
2. Click **Create**, then **Create custom attribution source**.
3. Select **Connect your own analytics tool**, then click **Next**.
4. In **Custom attribution source name**, enter a name for the settings you'll pick in Upstack, for example `Store_lastclick_paid_7D`. Names can be up to 50 characters.
5. Leave **Dataset** set to the dataset from step 1, and leave **Store custom attribution events in a different dataset** unchecked.
6. Click **Create**.

The dataset's **Overview** then shows **Complete setup for your custom attribution source**, with **Send events** still to do. That step completes once Upstack starts sending events.

Meta doesn't create the source for you when events arrive. Create one for each Meta dataset you send Upstack attribution to.

## How do I turn on Send Upstack Attribution to Meta?

1. Sign in to [app.upstackdata.com](https://app.upstackdata.com) and click **Destinations** in the left sidebar.
2. Click your Meta destination.
3. On the **Overview** tab, check that **Tracking Method** includes **Server** and that **Conversion API Key** is filled in.
4. Turn on **Send Upstack Attribution to Meta**.
5. Pick the **Attribution Model**, **Attribution Type** and **Lookback Window** that match your Custom Attribution Source's name.
6. Click **Save Changes**.

Upstack sends events for purchases from then on, about 15 minutes after each purchase.

## Which attribution model, type and lookback should I pick?

Pick the ones you trust in your Upstack reports. Meta gets the same credit those settings give.

| Setting | Options | What it means |
| - | - | - |
| **Attribution Model** | **Last click** (default) | The last click before the purchase gets the credit. |
| | **First click** | The first click before the purchase gets the credit. |
| | **Any click** | Meta gets the credit if any click before the purchase came from a Meta ad. |
| **Attribution Type** | **Paid clicks** (default) | Only paid traffic and ad platforms count as clicks. |
| | **All clicks** | Email, organic and referral visits count too. A later email click can take the credit from Meta. |
| **Lookback Window** | **7 days** (default) to **90 days**, or **Lifetime** | How long before the purchase a click can count. |

To change any of these later, create a new Custom Attribution Source in Meta with a matching name.

## What does Upstack send to Meta for each purchase?

| Field | Value |
| - | - |
| Event | `AppendAttribution` |
| Ad | The Meta ad ID from the credited click |
| Click time | When that click happened |
| Share | 1, full credit |
| Value | The purchase value Upstack sends with the Purchase |
| Original event | `Purchase`, with the purchase's event time and order ID |

## Why didn't Upstack send a purchase to Meta?

| What happened | Why |
| - | - |
| Meta didn't get the credit | Another channel won under your model, type and lookback. |
| The credited click has no ad ID | The Meta ad link was missing `utm_content={{ad.id}}`. |
| The order came from the Facebook or Instagram shop | Meta already has those orders. Upstack doesn't send their Purchase. |
| The purchase has no browser information | Meta needs the buyer's browser (user agent) on every event. |
| The click was in the same second as the purchase | Meta needs the click to come before the purchase. |
| The purchase is more than 7 days old | Meta rejects older purchases. |

## I have more than one Meta dataset. How do I set this up?

Turn the setting on for each Meta destination whose dataset has a Custom Attribution Source, and create a source on each dataset. Each destination sends its own events with its own settings.

Use one set of settings per dataset. If two Upstack destinations send to the same dataset with different settings, Meta gets two credits for the same order.

## How do I check that Meta is receiving the events?

1. In [Meta Events Manager](https://business.facebook.com/events_manager), open the dataset.
2. On **Overview**, find **Complete setup for your custom attribution source**.
3. Check that **Send events** is marked done. Meta then trains the source for about 14 days.

After setup, the source's card shows its status:

| Status | What it means |
| - | - |
| **Pending** | Meta is waiting for the first events. |
| **In Training** | Meta is learning from the events. This takes up to 14 days from the first high-quality event. |
| **Setup Complete** | Training is done. A Meta representative contacts you. |
| **Ready to Use** | You can build campaigns with the source. |
| **Quality Issue** | Meta found a problem. Open the card's **Diagnostics** tab for the fix. |

## How do I compare Meta's credit with Upstack?

1. Wait at least 72 hours after the first events.
2. On the **Custom Attribution Source** card, check that quality shows **High**.
3. Set a date range and click **Export Data**.
4. Add up **attributed\_value** for each day and compare it with the same days in Upstack.

Meta treats a difference of up to 5% as normal.

## How do I use the source in a campaign?

Once the source shows **Ready to Use**, create a new campaign in Ads Manager. In the ad set's attribution setting, select **Custom** and pick your Custom Attribution Source. Meta only allows this on new campaigns.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.