# Postback URL Integration

> Set up a postback URL to track conversions from any affiliate network or platform not listed in the AnyTrack Integration Catalog. This step-by-step guide covers link tagging, postback configuration, parameter mapping, and testing.

A postback URL (also called a callback URL or server-to-server URL) is how an affiliate network or conversion platform notifies AnyTrack when a conversion happens. Setting one up allows you to track conversions from platforms that are not in the [Integration Catalog](/docs/integration-catalog), then forward that data to your ad platforms through the Conversion API.

<Prerequisites
  title="Before you begin"
  items={[
    { label: "You have an AnyTrack account with a paid subscription", done: true },
    { label: "The AnyTrack Tracking Tag is installed on your website", done: true },
    { label: "You have an active account with the affiliate network or platform you want to integrate", done: true },
    { label: "Your network supports postback or webhook notifications", done: true },
    { label: "You know the tracking parameter name your network uses (e.g. subid, tid, epi)", done: true },
  ]}
/>

## How Postback Tracking Works

The postback URL connects AnyTrack to your affiliate network so conversions can be attributed to the ad click that started the visit.

1. A visitor clicks your ad and lands on your website.
2. AnyTrack generates a unique Click ID for that session.
3. The visitor clicks an affiliate link on your site. AnyTrack's [AutoTag](/docs/autotag) feature replaces the `--CLICK-ID--` placeholder in the link with the actual Click ID value.
4. Your affiliate network stores the Click ID alongside the visitor's session.
5. When a conversion happens, the network sends a postback to AnyTrack's webhook URL, including the stored Click ID.
6. AnyTrack matches the conversion to the original ad click and forwards it to your connected ad platforms (Google Ads, Meta, TikTok, etc.) through the Conversion API.

> 📘 **What makes this different from pixel tracking?**
>
> Postback URLs work server-to-server, meaning the conversion notification goes directly from your network's servers to AnyTrack. This is more reliable than client-side pixels because it is not affected by ad blockers, cookie restrictions, or browser privacy settings.

## Step 1: Find Your Network's Tracking Parameter

Before setting up anything in AnyTrack, you need one piece of information from your affiliate network: the name of the tracking parameter you can append to your affiliate links.

Each network uses a different parameter name. Here are common examples:

| Network          | Tracking Parameter |
| ---------------- | ------------------ |
| ClickBank        | `tid`              |
| Impact           | `subId1`           |
| CJ Affiliates    | `sid`              |
| Everflow         | `sub1`             |
| CAKE             | `s2`               |
| Adtraction       | `epi`              |
| HasOffers / TUNE | `aff_sub`          |

Check your network's documentation for terms like "tracking parameter," "SubID," "custom parameter," or "external tracking." If you cannot find it, contact your network's support team.

## Step 2: Tag Your Affiliate Links

Add your network's tracking parameter with the `--CLICK-ID--` placeholder to every affiliate link on your site.

**If your link has no existing parameters:**

```
https://network.com/offer123?sub1=--CLICK-ID--
```

**If your link already has parameters (notice the & instead of ?):**

```
https://network.com/offer123?campaign=spring&sub1=--CLICK-ID--
```

Replace `sub1` with whichever parameter your network uses.

When a visitor clicks the link, AnyTrack's [AutoTag](/docs/autotag) feature automatically replaces `--CLICK-ID--` with the real Click ID for that session. Your network then stores this value and sends it back in the postback when a conversion occurs.

> ⚠️ **Warning**
>
> Do not use link shorteners (like bit.ly) on tagged affiliate links. They strip tracking parameters and break the Click ID handoff. If you use a redirect plugin, make sure it passes URL parameters through to the final destination.

## Step 3: Create a Custom Integration in AnyTrack

1. Log in to your [AnyTrack dashboard](https://dashboard.anytrack.io/catalog/).
2. Go to **Integrations** and click **Add Integration**.
3. Search for **Custom Integration** and click **Install**.
4. Fill in the details:
   * **Name**: A recognizable label (e.g., "MyNetwork Postback")
   * **Login URL**: The URL where you log in to your network (optional, for quick access)
   * **Sub ID/Click ID Placeholder**: The postback variable your network uses to return the Click ID (e.g., `${sub1}`, `{clickid}`, or `#s2#` depending on your network's syntax)
   * **Commission/Payout Placeholder**: The variable for the conversion amount (e.g., `${payout}`, `{commission}`)
   * **Transaction ID Placeholder**: The variable for the unique transaction identifier (optional but recommended)
5. Click **Save**.

After saving, AnyTrack generates a unique webhook URL for this integration. This is your postback URL.

## Step 4: Copy and Customize the Postback URL

Your generated webhook URL will look something like this:

```
https://t1.anytrack.io/XXXXXXXX/collect/my-network?click_id=${sub1}&amount=${payout}&transaction_id=${txn_id}
```

The parameters after the `?` are populated based on what you entered in Step 3. Review them to make sure each value maps correctly to your network's postback variables.

### Key Parameters

| AnyTrack Parameter | Purpose                                                   | Required?   |
| ------------------ | --------------------------------------------------------- | ----------- |
| `click_id`         | Links the conversion to the original visitor session      | **Yes**     |
| `amount`           | Revenue or commission value (determines Lead vs Purchase) | Recommended |
| `transaction_id`   | Unique conversion ID, prevents duplicate reporting        | Recommended |
| `currency`         | Currency code (e.g., USD, EUR)                            | Optional    |
| `event`            | Custom event name (e.g., Sale, Trial, Signup)             | Optional    |

> 📘 **How AnyTrack classifies conversions**
>
> AnyTrack automatically determines the conversion type based on the amount value. When amount equals 0, the conversion is recorded as a **Lead**. When amount is greater than 0, it is recorded as a **Purchase**. No manual configuration is needed.

### Adding Geographic Data for Better Attribution

Some affiliate networks include geographic information in their postbacks. If your network provides country, state, city, or zipcode variables, append them to improve ad platform matching:

```
&country=${country}&state=${state}
```

AnyTrack automatically formats and hashes this data before forwarding it to ad platforms like Meta and Google Ads. See the full list of supported fields in the [Event Attributes](/docs/event-attributes) reference.

## Step 5: Paste the Postback URL in Your Network

1. Log in to your affiliate network or platform.
2. Find the postback or webhook settings. Look for sections labeled **Postback URL**, **Callback URL**, **S2S Tracking**, **Server-to-Server**, or **Webhook**.
3. Paste the complete postback URL from Step 4.
4. Save the configuration.

> 📘 **Network-specific syntax**
>
> Different networks format their postback variables differently. For example, some use `${sub1}`, others use `{sub1}`, `#sub1#`, or `[sub1]`. Always follow your network's documentation for the correct variable syntax.

## Step 6: Test Your Integration

After setup, trigger a test conversion to confirm data is flowing correctly.

1. Open the **Events Log** for your Custom Integration in the AnyTrack dashboard.
2. Either use your network's test conversion feature (if available) or complete an actual test conversion on an offer.
3. Check the Events Log for a new entry.

**A green status** confirms the postback was received and matched to a Click ID. You are all set.

**Common errors and what they mean:**

| Error               | Cause                                                       | Fix                                                                                           |
| ------------------- | ----------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| Missing click_id    | The Click ID is not being passed in the postback            | Verify your link tagging in Step 2 and the Sub ID mapping in Step 3                           |
| No match(es) found  | The Click ID value does not match any recorded session      | Confirm the Tracking Tag is installed and the visitor clicked a tagged link before converting |
| No events appearing | The postback URL is not configured correctly in the network | Re-check the URL you pasted in Step 5                                                         |

## When to Use Zapier or Make Instead

Some platforms (like HubSpot, Mailchimp, or Salesforce) send webhooks with a fixed payload structure that does not match AnyTrack's query parameter format. In these cases, use [Zapier](https://zapier.com) or [Make](https://make.com) as a middle layer: catch the webhook from your platform, reformat the data, and post it to your AnyTrack webhook URL. See the [Webhooks](/docs/webhooks) guide for details.

<FaqAccordion
  title="Postback URL FAQ"
  icon="fa-duotone fa-circle-question"
  items={[
    {
      question: "How do I find my postback URL after creating the integration?",
      answer: "After saving your Custom Integration in AnyTrack, the webhook URL appears on the integration settings page. Copy the full URL including all query parameters. This is the postback URL you paste into your affiliate network. You can edit the parameters at any time by updating the integration settings."
    },
    {
      question: "Can I track multiple affiliate networks using postback URLs?",
      answer: "Yes. Create a separate Custom Integration for each network. Each one generates its own postback URL with field mappings specific to that network's variables. There is no limit to the number of custom integrations you can create."
    },
    {
      question: "What if my affiliate network does not support postback notifications?",
      answer: "If your network only supports client-side tracking pixels and does not offer postback or webhook notifications, you cannot use this method. Check the <a href='/docs/integration-catalog'>Integration Catalog</a> for pre-built integrations that may support your network through other tracking methods."
    },
    {
      question: "Why are my conversions showing as Lead instead of Purchase?",
      answer: "AnyTrack classifies conversions based on the <code>amount</code> parameter. If the amount equals 0 or is missing, the conversion is recorded as a Lead. Make sure the commission or payout variable in your postback URL maps correctly to the <code>amount</code> parameter so AnyTrack receives the actual conversion value."
    },
    {
      question: "Can I use a postback URL without installing the AnyTrack Tracking Tag?",
      answer: "The Tracking Tag is required for postback integrations that rely on Click ID matching. Without it, AnyTrack cannot generate the Click ID that links the conversion back to the original ad click. If your use case involves server-side-only tracking with an external identifier, see the <a href='/docs/external-id-as-click-id'>External ID as Click ID</a> guide."
    }
  ]}
/>

<Cards columns={3}>

  <Card title="Event Attributes" icon="fa-duotone fa-list-check" href="/docs/event-attributes">
    <p>Full list of parameters you can pass in your postback URL to enrich conversion data.</p>
  </Card>

  <Card title="Custom Affiliate Networks" icon="fa-duotone fa-diagram-project" href="/docs/custom-affiliate-networks">
    <p>Detailed walkthrough using Adtraction as a complete example.</p>
  </Card>

  <Card title="AutoTag" icon="fa-duotone fa-tags" href="/docs/autotag">
    <p>How AnyTrack automatically replaces Click ID placeholders in your links.</p>
  </Card>

</Cards>

<TrackingFlow
  title="Postback URL Tracking Flow"
  subtitle="How AnyTrack tracks conversions from affiliate networks using postback URLs"
>
  <FlowStep number={1} phase="visitor" title="Visitor Lands on Your Website">
    A visitor clicks your ad (Google, Meta, TikTok, etc.) and arrives on your landing page. The AnyTrack Tracking Tag fires a PageView event and generates a unique Click ID.
  </FlowStep>

  <FlowStep
    number={2}
    phase="visitor"
    title="Visitor Clicks an Affiliate Link"
    code="https://network.com/offer123?sub1=--CLICK-ID--"
  >
    Your landing page contains an affiliate offer link with a tracking parameter placeholder.
  </FlowStep>

  <FlowStep
    number={3}
    phase="AnyTrack"
    title="AutoTag Appends the Click ID"
    code="https://network.com/offer123?sub1=at_cl1d_abc123xyz"
  >
    AutoTag detects the --CLICK-ID-- placeholder and replaces it with the actual Click ID value.
  </FlowStep>

  <FlowStep
    number={4}
    phase="AnyTrack"
    title="OutboundClick Event Tracked"
    note="Click ID at_cl1d_abc123xyz stored with full session context — ready to match when the conversion comes back."
  >
    AnyTrack fires an OutboundClick event and stores the Click ID along with session data (UTM parameters, landing page, referrer, device info).
  </FlowStep>

  <FlowDivider />

  <FlowStep number={5} phase="network" title="Network Stores the Click ID">
    The visitor arrives on the affiliate offer page. The network ingests the tracking parameter (sub1=at_cl1d_abc123xyz) and stores it alongside the session.
  </FlowStep>

  <FlowStep number={6} phase="network" title="Conversion Triggered">
    The visitor completes the desired action (purchase, signup, lead form). The network records the conversion and fires the AnyTrack postback URL.
  </FlowStep>

  <FlowDivider />

  <FlowStep
    number={7}
    phase="postback"
    title="Network Calls the AnyTrack Postback URL"
    code="https://t1.anytrack.io/XXXXXXXX/collect/my-network?click_id=at_cl1d_abc123xyz&amount=32.50&transaction_id=TXN-98421&currency=USD"
  >
    The network sends a server-to-server request to AnyTrack, passing the stored Click ID and conversion details.
  </FlowStep>

  <FlowDivider />

  <FlowStep number={8} phase="result" title="Click ID Matched . Conversion Tracked">
    AnyTrack matches the Click ID to the original session, attributing the $32.50 conversion to the ad click, campaign, and traffic source.
    <FlowResults
      label="Conversion forwarded to"
      items={[
        { logo: readmeAsset1.src, label: "AnyTrack", detail: "Dashboard and Reports" },
        { logo: "/assets/docs/custom/google-analytics.svg", label: "Google Analytics 4", detail: "Measurement Protocol" },
        { logo: "/assets/docs/custom/google-ads.svg", label: "Google Ads", detail: "Conversion API" },
        { logo: "/assets/docs/custom/meta-ads.png", label: "Meta Ads", detail: "Conversion API" },
      ]}
    />
  </FlowStep>
</TrackingFlow>
