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

# Postbacks

> Set up postback notifications for CPL campaigns on OnlyTraffic. Learn about events, URL macros, and integration with external trackers.

## What Are Postbacks?

Postbacks are **HTTP notifications** that OnlyTraffic sends to your server or tracking platform when specific events occur — like a new subscriber joining or a transaction happening. They let you track conversions in real time without manually checking the dashboard.

## Setup Levels

You can configure postbacks at two levels:

| Level | Scope | Use Case |
| - | - | - |
| **Account-level (Default)** | Applies to all your campaigns | Set once, works everywhere |
| **Campaign-level** | Overrides default for a specific campaign | Custom tracking per campaign |

Campaign-level postbacks take priority over account-level settings when both are configured.

**Campaign-level:** on the CPL or RevShare campaigns page open the campaign's actions menu (the **…** button in its row) and choose **Postbacks**. A campaign that already has a custom destination shows a **Postback** chip in its row; clicking the chip opens the same editor.

**Account default:** go to **Tools → Postback Logs** and click **Default postback**. There you can also push the default to campaigns you already run (active campaigns without a postback, all active, all without a postback, or all). Pushing to "all active" or "all" replaces whatever those campaigns have now, ad-platform pixel setups included.

## Available Events

### `new_subscriber`

Fired when a new fan subscribes through your campaign.

### `new_transaction`

Fired when a fan makes a purchase (tip, paid message, paid post, subscription, resubscription, or stream).

### `new_dialog`

Fired once per fan when they send the model three or more messages.

### `marketing_stop`

Fired when a RevShare campaign or CPL campaign is stopped (completed, cancelled, or paused).

## URL Template & Macros

Build your postback URL using macros that get replaced with actual values when the event fires.

### Event Macro

| Macro | Description |
| - | - |
| `{{event}}` | Event name: `new_subscriber`, `new_transaction`, `new_dialog`, or `marketing_stop` |

### Campaign Macros

| Macro | Description |
| - | - |
| `{{campaign.id}}` | Marketing campaign ID |
| `{{campaign.name}}` | Campaign name (URL-encoded) |
| `{{campaign.date_create}}` | Campaign creation date (UNIX timestamp) |
| `{{campaign.onlyfans_id}}` | OnlyFans model account user ID |
| `{{campaign.order_id}}` | CPL campaign ID (for `marketing_stop` event) |
| `{{campaign.date_finish}}` | Campaign finish date, UNIX timestamp (for `marketing_stop` event) |

### Subscriber Macros

Available for `new_subscriber`, `new_transaction` and `new_dialog` events:

| Macro | Description |
| - | - |
| `{{subscriber.id}}` | OnlyFans subscriber user ID |
| `{{subscriber.campaign_id}}` | Marketing campaign ID |
| `{{subscriber.onlyfans_id}}` | OnlyFans model account user ID |
| `{{subscriber.name}}` | Subscriber's name (URL-encoded) |
| `{{subscriber.revenue}}` | Total commission earned from this subscriber |
| `{{subscriber.date_subscribe}}` | Subscription date (UNIX timestamp) |
| `{{subscriber.click_id}}` | Your click ID (if using tracking links) |

### Transaction Macros

Available for the `new_transaction` event:

| Macro | Description |
| - | - |
| `{{transaction.id}}` | Unique transaction ID |
| `{{transaction.campaign_id}}` | Marketing campaign ID |
| `{{transaction.subscriber_id}}` | OnlyFans subscriber user ID |
| `{{transaction.onlyfans_id}}` | OnlyFans model account user ID |
| `{{transaction.type}}` | Type: `tip`, `message`, `post`, `subscription`, `resubscription`, `stream`, `other` |
| `{{transaction.amount}}` | Total transaction amount |
| `{{transaction.revenue}}` | Your commission from this transaction |
| `{{transaction.date}}` | Transaction date (UNIX timestamp) |

### Click Macros

Available when using OT Tracking Links or Smart Links:

| Macro | Description |
| - | - |
| `{{click.click_id}}` | Internal click ID |
| `{{click.url}}` | OnlyFans destination URL |
| `{{click.external_click_id}}` | Your custom click ID (passed via `click_id` parameter) |
| `{{click.expires_ts}}` | URL expiration date (UNIX timestamp) |
| `{{click.expires}}` | URL expiration date (ISO 8601 string) |

### Click Param Macros

Any parameter you add to a tracking-link click as `params[NAME]=VALUE` is readable back as `{{click_params.NAME}}`, for example `{{click_params.fbp}}` or `{{click_params.uid}}`. UTM parameters (`utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, `utm_term`), `gclid` and `msclkid` are captured automatically. Up to 30 params per click, name up to 64 and value up to 255 characters; a param that did not arrive on the click resolves to an empty string.

### Modifiers

Append a modifier to any macro to transform its value before sending:

| Modifier | Effect |
| - | - |
| `{{subscriber.name\|sha256}}` | SHA-256 hash of the value (trimmed and lowercased first); empty values stay empty |
| `{{click.user_agent\|json}}` | Escapes the value for use inside a JSON string in a POST body |

## HTTP Methods

| Method | Behavior |
| - | - |
| **GET** | Macros are placed directly in the URL query string |
| **POST** | Macros can be used in both the URL and the request body |

## Custom Headers

You can add custom HTTP headers to your postback requests. This is useful for:

* Authentication tokens (e.g., `Authorization: Bearer your_token`)
* Content type specification (e.g., `Content-Type: application/json`)
* Any custom headers your tracking platform requires

## Example Postback URLs

<CodeGroup>
  ```text Simple GET theme={null}
  https://your-tracker.com/postback?event={{event}}&sub_id={{subscriber.id}}&revenue={{subscriber.revenue}}&click_id={{click.external_click_id}}
  ```

  ```text Voluum theme={null}
  https://your-voluum-domain.com/postback?cid={{click.external_click_id}}&payout={{subscriber.revenue}}
  ```

  ```text Binom theme={null}
  https://your-binom-domain.com/click/pb?cnv_id={{click.external_click_id}}&payout={{subscriber.revenue}}&event={{event}}
  ```

  ```text Keitaro theme={null}
  https://your-keitaro-domain.com/postback?subid={{click.external_click_id}}&sum={{subscriber.revenue}}&status={{event}}
  ```
</CodeGroup>

## Testing Postbacks

You can test your postback configuration before going live:

<Steps>
  <Step title="Set up your postback URL">
    Configure your postback URL with the desired macros.
  </Step>

  <Step title="Click Send test">
    Use the **Send test** button under the event in the postback editor. Every macro found in your URL, body or headers becomes a field prefilled with a sample value; edit the values if you like and click **Send now**. The request goes out from OnlyTraffic's servers exactly like a real event, and the HTTP status and response body are shown right there. Test sends are not recorded in Postback Logs.
  </Step>

  <Step title="Verify receipt">
    Check that your server or tracking platform received the test postback and parsed the parameters correctly.
  </Step>
</Steps>

<Tip>
  Use a service like [webhook.site](https://webhook.site) to inspect postback requests during setup. This helps you verify the exact data being sent before connecting to your production tracker.
</Tip>

<Info>
  Postbacks work best with [OT Tracking Links](/docs/partners/tracking-links) that support the `click_id` parameter. This allows you to match each conversion back to the exact click in your external tracker.
</Info>


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