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

# Track in-app purchases with Adjust

> Report purchases made in your app to Lemrock, with Adjust and the server API.

The Lemrock Pixel does not work in a mobile app. If you measure your app with Adjust, purchases are reported as follows:

1. A visitor clicks a Lemrock ad. Lemrock adds `lrclid` to your Adjust link.
2. Adjust records `lrclid`, then ties the install and purchases to that click.
3. On every purchase, Adjust calls your server with `lrclid`.
4. Your server sends the purchase to Lemrock.

## Before you start

* **The Adjust SDK is integrated** in your app and your purchase event is tracked in Adjust, with its amount and currency.
* **The order ID is sent with the purchase event**, as an Adjust SDK callback parameter (for example `order_id`). It makes sure each order is counted once.
* **Your Lemrock API key** (`lr_sk_...`), from your Lemrock contact.

## 1. Create an Adjust link for Lemrock

In Adjust, go to **Campaign Lab > Custom links** and create a link with `Lemrock` as the **Channel**. A dedicated link lets Adjust attribute installs to Lemrock rather than to another source.

In the link's **Attribution settings** screen, set the click attribution window (**Device matching**) to **30 days**.

Send this link to your Lemrock contact: your Lemrock ads will point to it.

On every click, Lemrock adds its click ID to the link:

```
https://app.adjust.com/abc123?lrclid=lr_clk_3xk9Qm2vT8LpW1nRz5bYcA
```

## 2. Add a purchase callback

In Adjust, go to **AppView**, open your app, then **Data management > Server callbacks** and add a callback for your purchase event, to an endpoint on your server:

```
https://your-server.com/adjust/lemrock?lrclid={dcp_lrclid}&created_at={created_at}&revenue={revenue_float}&currency={currency}
```

`{dcp_lrclid}` holds the Lemrock click ID that Adjust recorded at click time. It is empty if the purchase does not come from a Lemrock click. Adjust appends the callback parameters sent by your SDK to the URL, including the order ID: `&order_id=12345`.

## 3. Send the purchase to Lemrock

For every callback received, your server sends the purchase, whether or not it comes from a Lemrock click, to the [server API](/en/conversion-tracking/server-api) as `order_created`:

```json theme={null}
{
  "event_type": "order_created",
  "event_id": "12345",
  "event_time_ms": 1788954030000,
  "lrclid": "lr_clk_3xk9Qm2vT8LpW1nRz5bYcA",
  "user": { "email_sha256": "86e0b9e5..." },
  "data": {
    "type": "contents",
    "amount": 2599,
    "currency": "EUR"
  }
}
```

| Lemrock field | Adjust value |
| - | - |
| `lrclid` | `{dcp_lrclid}`, omitted when empty |
| `event_id` | your order ID, never Adjust's `{event}` |
| `event_time_ms` | `{created_at}` (in seconds) × 1000 |
| `amount` | `{revenue_float}` × 100, rounded: `2599` for €25.99 |
| `currency` | `{currency}` |
| `user` | the customer's email, [hashed](/en/conversion-tracking/reference#hash-email-and-phone), looked up by your server from the order ID |

Only send Lemrock purchases from users who accepted advertising tracking in your app, including Lemrock.

## 4. Test

1. On an Android phone without your app, open your Adjust link with `?lrclid=lr_clk_0000000000000000000000` added.
2. Install the app, open it and make a test purchase.
3. Check that your server receives the callback with `lrclid=lr_clk_0000000000000000000000`.
4. Send the purchase to Lemrock with `"validate_only": true`: the response must be `202`.

Repeat on iPhone, once allowing and once refusing tracking when the app opens.

## Limits

* **iOS**: if the user refuses tracking (ATT), Adjust may not tie the install to the click. The purchase is then not attributed to Lemrock.
* **Other source**: Adjust attributes each install to the last click. If the user then clicked another network's ad, or is reattributed to another network, Adjust no longer returns the Lemrock `lrclid`.
* **Installs**: only purchases are reported for now.


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