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

# AppLovin Ads

> Paste your AppLovin keys and deliver conversions to AppLovin's Conversion API and pixel.

When you finish, DATALYR sends conversions to AppLovin's Conversion API and runs AppLovin's pixel. When both send one event, AppLovin keeps one copy.

## Before you start

| Requirement | Detail |
| - | - |
| AppLovin Ads account for websites | App and web campaigns use separate AppLovin accounts |
| Event Key | **Account → General → Keys** in the AppLovin dashboard |
| Conversion API key | The same **Keys** page. If it isn't there, contact your AppLovin representative or open a support ticket |
| Report Key | Optional. The same **Keys** page. Conversions don't use it |
| Tracking script | On every page your AppLovin ads send traffic to. See [Install](/installation/index). With npm, use `@datalyr/web` 1.9.10 or later |
| Customers outside excluded regions | AppLovin takes no data about people in 30 countries, the UK included. See [Regions AppLovin doesn't get](#regions-applovin-doesnt-get) |

DATALYR doesn't import AppLovin spend or ad stats.

## Connect AppLovin

<Steps>
  <Step title="Open the form">
    Open **Sources**. Select **Connect** on the **AppLovin Ads** row.
  </Step>

  <Step title="Paste the keys">
    Fill **Event Key** and **Conversion API key**. Add the **Report Key** if you have it.
  </Step>

  <Step title="Pick the account type">
    Choose **Account type** from the table below. Ask your AppLovin representative if you aren't sure.
  </Step>

  <Step title="Answer the Shopify question">
    Set **AppLovin Shopify app or pixel already sending events?** to **Yes** or **No**.
  </Step>

  <Step title="Save">
    Select **Connect**.
  </Step>
</Steps>

| **Account type** | What DATALYR sends |
| - | - |
| **Purchase** (default) | Every event in [Events](#events), from the server and the pixel |
| **Lead generation** | `page_view` and `generate_lead` only |
| **Restricted lead generation** | `page_view` and `generate_lead` from the server only. No pixel, no email or phone, and the page URL cut to your domain |

| Message on save | Meaning |
| - | - |
| `AppLovin rejected this Report Key` | The Report Key is wrong |
| `Report Key not verified` | AppLovin didn't answer. The connection saved anyway |
| None for the Conversion API key | AppLovin has no test call for it. A wrong key shows on the first delivery |

### If the AppLovin Shopify app already sends events

Two pixels count every sale twice. While the answer is **Yes**, DATALYR doesn't load its pixel.

1. In the AppLovin Shopify app, turn off **Send data**. Keep the app, so your catalog and order history still sync.
2. In DATALYR, open **Sources**. Select **Manage** on **AppLovin Ads**.
3. Select **Edit setup**. Change the answer to **No**. Select **Save changes**.

## Create the rules

<Steps>
  <Step title="Open conversion setup">
    In **Sources**, find your revenue source. Select its flag button, **Set up conversions**.
  </Step>

  <Step title="Pick AppLovin">
    Tick **AppLovin · Web**. **Event Key** shows **Connected AppLovin Event Key**.
  </Step>

  <Step title="Create the rules">
    Open **Preview *n* mappings** to read the rules, where *n* is the rule count. Select **Create rules**.
  </Step>
</Steps>

To build a rule by hand, pick **AppLovin** as **target platform** in **Conversions**. Pick the key under **AppLovin Event Key**.

## Tag your ads

AppLovin adds its click ID, `aleid`, to every website click. Keep it on the landing URL through every redirect.

1. Open **Track**. Create a link.
2. Under **paste into your ads**, find **AppLovin Ads**. Select **copy parameters**.
3. Paste them into the AppLovin campaign's **Tracking Parameters**.

```text theme={null}
utm_source=applovin&utm_medium=paid&utm_campaign={CAMPAIGN_NAME}&utm_content={CREATIVE_SET}&campaign_id={CAMPAIGN_ID}&adset_id={CREATIVE_SET_ID}
```

A creative set with its own URL needs the parameters too. AppLovin has no ad-level macro for web.

## Reference

### Events

| DATALYR trigger event | AppLovin event |
| - | - |
| `purchase`, `checkout.session.completed`, `invoice.payment_succeeded`, `subscription_started`, `trial_converted` | `purchase` |
| `trial_started` | `subscribe` |
| `subscribe` | `subscribe` |
| `checkout_started` | `begin_checkout` |
| `add_to_cart` | `add_to_cart` |
| `view_item` | `view_item` |
| `add_payment_info` | `add_payment_info` |
| `signup` | `sign_up` |
| `form_submit`, `lead` | `generate_lead` |
| `search` | `search` |
| `login`, `view_cart`, `remove_from_cart` | The same name |
| `pageview` | `page_view`. From the pixel, or from the server on **Restricted lead generation** |
| Anything else | Not sent. AppLovin bans custom event names |

| AppLovin event | Value |
| - | - |
| `purchase` from Shopify or Stripe | Subtotal after discounts, before tax and shipping |
| `purchase` from other sources | The rule's value |
| `purchase` fields | Also sends `items`, `shipping`, and `transaction_id`. `tax` only when the source records it. A \$0 purchase isn't sent |
| `generate_lead` | The rule's value. Required, because AppLovin reads 0 as a junk lead |
| `subscribe` from a trial | The trial's published expected value, else 0 |
| `subscribe`, `add_payment_info` | The rule's value, else 0 |
| `begin_checkout` | The rule's value, else the sum of the items, else 0 |
| Currency | The event's, else the rule's, else `USD` |

Renewals stay out unless you include them in **Set up conversions**.

### Matching fields in `user_data`

| Field | Source | Normalization |
| - | - | - |
| `aleid` | The click ID, from the event or the visitor's earlier visits | not hashed |
| `axwrt` | The AppLovin pixel's browser ID | not hashed |
| `client_id` | The `distinct id` | not hashed |
| `user_id` | The `user_id` from `identify()`, else the source's `customer_id`. 6 characters or more, never an email or phone | not hashed; digits only on restricted lead generation |
| `email` | Email in the event | trim, lowercase, Gmail dots and `+suffix` removed, SHA-256 |
| `phone` | Phone in the event | digits with country code, no leading zeros, 8–15 digits, SHA-256 |
| `client_ip_address`, `client_user_agent` | The browser behind the event | not hashed; required on every event |
| `zip`, `country_code` | The event's address fields. Country falls back to the visitor's IP country | US zips cut to 5 digits |

AppLovin needs one of `client_id`, `axwrt`, `alart`, `user_id`, `email`, or `phone`. The page URL keeps only `aleid` and `utm_*`.

### Deduplication

Both copies carry one `dedupe_id`: a purchase's order ID, else the DATALYR event ID. AppLovin merges two events with one `dedupe_id` within five minutes and drops a later duplicate.

### The AppLovin pixel

DATALYR loads AppLovin's pixel through your tracking script as soon as AppLovin is connected.

| The pixel loads only when | Detail |
| - | - |
| The visitor gave marketing consent | Never before, and never with `privacyMode: 'strict'` |
| The browser sends no opt-out | No Do Not Track, Global Privacy Control, or US privacy opt-out, whatever your site settings say |
| The visitor's country is known and allowed | Decided from the visitor's IP |
| **Account type** is **Purchase** or **Lead generation** | |
| The Shopify answer is **No**, and no other AppLovin pixel is on the page | |
| **Filter health-related fields** is off | **Settings → Privacy & redaction** |

| What the pixel sends | When |
| - | - |
| Page views | From the moment AppLovin is connected, before any rule |
| Events your website rules cover | Once the rules exist |
| Purchases | Only when no verified revenue source, such as Shopify or Stripe, is connected. Otherwise the server sends them |

| AppLovin pixel setting | Default | Effect | To turn it off |
| - | - | - | - |
| `autoEmailCapture` | On | Reads email addresses typed into forms on your pages | AppLovin documents no setting. Contact AppLovin support |
| `autoSpaPageView` | On | Sends page views in single-page apps. When it's off, DATALYR sends them | AppLovin documents no setting. Contact AppLovin support |

| Content Security Policy directive | Allow |
| - | - |
| `script-src` | `https://s.axon.ai`, `https://res4.applovin.com` |
| `connect-src` | `https://b.applovin.com`, `https://re.applovin.com` |
| `img-src` | `https://cm.g.doubleclick.net`, for AppLovin's Google cookie match |

### Regions AppLovin doesn't get

| Case | Result |
| - | - |
| The person is in `AX`, `AD`, `AT`, `BE`, `DK`, `FO`, `FI`, `FR`, `DE`, `GI`, `GR`, `GG`, `IS`, `IE`, `IM`, `IT`, `JE`, `LI`, `LU`, `MT`, `MC`, `NL`, `NO`, `PT`, `SM`, `ES`, `SJ`, `SE`, `CH`, or `GB` | Never sent |
| The event has a country value DATALYR can't recognise | Not sent |
| The event has no country anywhere | Sent. Whop, Superwall, and RevenueCat purchases often carry none |
| Pixel, visitor's IP country unknown | The pixel doesn't load |
| Order the server reads countries in | Billing address, then customer, shipping, and profile fields, then the visitor's IP country. The first one found decides |

### Consent

The Conversion API has no consent field, so DATALYR withholds the whole event.

| Signal on the event | Result |
| - | - |
| Marketing consent denied, or a sale opt-out | Not sent |
| Do Not Track or Global Privacy Control | Not sent |
| `us_privacy` string with an opt-out | Not sent |

### Add a line to your privacy policy

Sharing with AppLovin is for advertising, and some US state laws count it as a sale or share. You can adapt this text:

```text theme={null}
We use DATALYR to share information with AppLovin for interest-based advertising and to
measure our ads: the pages you visit, the products and order value of your purchases,
your IP address and browser, and your email address and phone number in hashed form.
AppLovin's pixel can also read email addresses you type into our forms. When you decline
marketing cookies, opt out of sale or sharing, or your browser sends Do Not Track or
Global Privacy Control, we withhold these events.
```

This sentence is a starting point, not legal advice. Check it with your own adviser before you publish it.

## Verify

1. Open **Conversions**. Select **manage rules**. Open your rule.
2. Select **send test event**. AppLovin has no test mode, so DATALYR checks the event and sends nothing.
3. Trigger one real event.
4. Confirm the rule's `sent` count went up by 1.
5. Open **Health**. Select **Delivery**.
6. Confirm the AppLovin row reads `Working`.

## When it does not work

| Reason in **Health** | `error_type` | Fix |
| - | - | - |
| `Sent by the pixel` | `pixel_handles_page_view` | Nothing. Page views come from the pixel |
| `Region excluded from sharing` | `region_excluded` | Nothing. The customer is in an excluded country |
| `Visitor declined tracking` | `consent_blocked` | Nothing. The visitor opted out |
| `No AppLovin standard event for it` | `unsupported_event` | Map the trigger to an event in [Events](#events) |
| `Event not allowed for this account type` | `event_not_allowed_for_account` | Send `generate_lead`, or correct **Account type** |
| `No match key the platform accepts` | `no_strong_identifier` | Call `identify()`, or send email or phone with the event |
| `Event failed the platform's checks` | `invalid_batch_member` | Read the missing field on the delivery row. A webhook sale needs a linked visit for IP and user agent |
| `Zero-value purchase` | `zero_value_purchase` | Point the rule's value at the amount field |
| `Older than the platform's window` | `too_old` | Nothing. DATALYR stops at 28 days |
| `Access token expired or revoked` | `AUTH_ERROR` | Select **Manage**. Select **Update credentials**. Paste the Conversion API key again |
| AppLovin counts every sale twice | none | Turn off **Send data** in the AppLovin Shopify app |

## Next

* [Conversion delivery](/advanced/conversion-delivery): retry, dedup, and status rules for every platform.
* [Health](/product/health): read the delivery and match-quality tabs.
* [Tracking links](/product/tracking-links): build the link your ads point to.


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