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

# TrafficFactory as a Traffic Source

> Track TrafficFactory campaigns in ClickFlare, add the conversions_tracking click ID and post conversions back to a TrafficFactory goal.

![TrafficFactory traffic source template](https://mintcdn.com/clickflare/0jaeWC_DJvLt2SMH/images/integrations/covers/templates/trafficfactory.png?fit=max\&auto=format\&n=0jaeWC_DJvLt2SMH\&q=85\&s=8fac66143150be6ef80994abe9f7d1fe)

TrafficFactory is a global ad network that sells traffic on a real-time bidding model, with geo-targeting and pricing models such as CPM and CPC. Its advertiser platform runs on the EXADS ad server. This guide sets up TrafficFactory as a traffic source in ClickFlare. It covers passing TrafficFactory's click data into your reports and sending conversions, with their value, back to TrafficFactory so its goal stats and your reports agree.

You do everything from the **campaign editor**. The TrafficFactory traffic source is created inline, without leaving the campaign.

> [!WARNING]
>
> The TrafficFactory template has no postback URL, so you add it by hand in Step 2. Without it, ClickFlare tracks TrafficFactory visits but can't report conversions back. The template's Zone ID row also needs one value from you. Step 1 shows it.

## At a glance

| | |
| - | - |
| **Ad formats** | Chosen per campaign through the campaign type in TrafficFactory |
| **Click ID macro** | `{conversions_tracking}`, a unique ID per click. The template passes it in `tag`. |
| **Conversion tracking** | Conversion Tracking API (S2S) to a `tag.php` URL, with a goal ID per event |
| **Payout passed back** | Yes, in the `value` parameter, on goals with a **Dynamic** conversion value |
| **Multiple events** | Yes, one conversion goal per event, shown as G1, G2... in TrafficFactory stats |
| **Cost** | Passed by the template as TrafficFactory's `{actual_cost}`. Cost Model: **Not Tracked**. Check it on CPM campaigns. |
| **Conversion API** | No |

## How it works

**1. TrafficFactory sends the click**

A visitor clicks your ad. TrafficFactory opens your ClickFlare campaign URL and fills in its tokens: the click ID in `tag`, the cost in `cost`, plus the campaign, category, site, zone and targeting details from the template.

**2. ClickFlare stores the TrafficFactory click ID**

ClickFlare saves the value of `tag` as the visit's **External ID**, records the cost, and redirects the visitor to your lander or offer.

**3. The conversion reaches ClickFlare**

Your affiliate network or store posts the conversion back to ClickFlare, matched on the ClickFlare click ID.

**4. ClickFlare posts it back to TrafficFactory**

ClickFlare calls TrafficFactory's conversion URL for the goal, replacing `{external_id}` with the stored click ID and `{payout}` with the revenue. TrafficFactory matches it to the original click and counts it under the goal.

> [!NOTE]
>
> The mirror to keep straight: in the **campaign URL** you write *ClickFlare's* parameter (`tag`) and *TrafficFactory's* token (`{conversions_tracking}`). The template does this for you. In the **postback URL** you write *TrafficFactory's* parameter (`tag`) and *ClickFlare's* token (`{external_id}`). The name is the same on both sides. The values that fill it are different.

## Before you start

* **Set up your own tracking domain.** Run the campaign and the postback on your own custom domain. Shared domains get flagged by networks and blocked by browsers. See [Custom Domains](https://clickflare.com/docs/en/settings/custom-domains.md).
* **Have an offer ready in ClickFlare**, and its affiliate network set up to post conversions back to ClickFlare. See [Creating an Offer](https://clickflare.com/docs/en/tracking/creating-an-offer-1.md) and [Adding an Affiliate Network](https://clickflare.com/docs/en/tracking/adding-an-affiliate-network.md).
* **Create a conversion goal in TrafficFactory.** In your TrafficFactory account, go to **Campaigns → Conversion Tracking** and click **NEW CONVERSION GOAL**. Each goal has its own goal ID and conversion URL. See [Step 2](#step-2-set-up-the-postback).
* **Decide which conversions TrafficFactory should receive.** One goal per event. If your funnel has several steps (lead, then sale), decide now whether to send one event or several. See [Tracking several events](#tracking-several-events).

***

## Step 1 – Create the campaign and the TrafficFactory traffic source

1. Go to **Campaigns** and click **New**.
2. In **Traffic Source**, open the dropdown and click **+ New Traffic Source**.
3. Type `trafficfactory` in the search box and select the **TrafficFactory** template.
4. Enter a **Name**, for example `TrafficFactory`.
5. Leave **Cost currency** on **USD** unless your TrafficFactory account is billed in another currency.

The template fills in the **Parameters** table for you:

| Name | TS Parameter | TS Token (TrafficFactory macro) | ClickFlare Token | What it carries |
| - | - | - | - | - |
| Cost | `cost` | `{actual_cost}` | `{cost}` | The actual CPM or CPC paid for the impression or click. See [Cost](#cost). |
| External ID | `tag` | `{conversions_tracking}` | `{external_id}` | TrafficFactory's unique click ID. Required for the postback. |
| Campaign ID | `campaign.id` | `{campaign_id}` | `{trackingField1}` | The TrafficFactory campaign |
| Category ID | `category_id` | `{category_id}` | `{trackingField2}` | The detected category ID |
| Country | `country` | `{country}` | `{trackingField3}` | The visitor's country |
| Email Encoded | `email` | `{email_encoded}` | `{trackingField4}` | The encoded visitor email, when TrafficFactory has one |
| Format | `format` | `{format}` | `{trackingField5}` | The ad format or size, for example 300x250 |
| Keyword | `keyword` | `{keyword}` | `{trackingField6}` | The keyword, when the traffic has one |
| Site ID | `site_id` | `{site_id}` | `{trackingField7}` | The site where the ad was shown |
| Hostname | `hostname` | `{src_hostname}` | `{trackingField8}` | The hostname of the source site |
| Variation ID | `variation_id` | `{variation_id}` | `{trackingField9}` | The variation (banner or landing page) ID |
| Zone ID | `zone_id` | *(empty)* | `{trackingField10}` | The ad zone where the ad was shown. You fill in the token below. |

![The TrafficFactory template's Parameters table in ClickFlare, with TrafficFactory's macros pre-filled](https://mintcdn.com/clickflare/0jaeWC_DJvLt2SMH/images/integrations/templates/trafficfactory/parameters.png?fit=max\&auto=format\&n=0jaeWC_DJvLt2SMH\&q=85\&s=625bb288115561842d72e1b0975389a3)

### Fill in the Zone ID row

The template's Zone ID row has a parameter but an empty **TS Token**. Fill it in:

1. In the `Zone ID` row, click the **TS Token** field.
2. Enter `{zone_id}`.
3. Leave the **TS Parameter** on `zone_id` and the **ClickFlare Token** on `{trackingField10}`.

`{zone_id}` is the ad zone where TrafficFactory showed the ad. It is the main row for blacklists and bid changes, so don't leave it empty.

Each tracking field becomes a column you can group reports by. To pass more TrafficFactory data, click **Add Parameter**, give it a name and parameter, and enter the token as the **TS Token**. ClickFlare assigns the next free tracking field.

> [!WARNING]
>
> Don't change or remove the `External ID` row. Without `tag={conversions_tracking}` in the campaign URL, ClickFlare has no TrafficFactory click ID to send back, and TrafficFactory cannot match your conversions.

## Step 2 – Set up the postback

The postback is what sends conversions to TrafficFactory. It lives on the traffic source, so every campaign that uses this TrafficFactory traffic source sends conversions the same way.

The TrafficFactory template has no postback URL. When you turn on the postback, the field is empty. You build it from the conversion goal.

### Create a conversion goal in TrafficFactory

1. In TrafficFactory, go to **Campaigns → Conversion Tracking** and click **NEW CONVERSION GOAL**.
2. Set a **Name**, for example `Sale`.
3. Choose a **Conversion Type**, for example **Purchase - Credit Card** or **Lead - Single Opt In**. TrafficFactory's smart bidding uses it.
4. Set **Conversion Value** to **Dynamic**, so TrafficFactory takes the value you send. **Fixed** uses one amount you enter. **No Value** records no revenue.
5. Set **Count**: **One Conversion** counts one conversion per click, **Every Conversion** counts each one.
6. Set the **Conversion Window**, how long after the click a conversion still counts. The default is 24 hours. Set it to match your offer, for example 7 or 30 days for a trial that converts later.
7. Set the **Order**. It decides the goal's column: order 1 shows as G1 in **Statistics**.
8. Click **Create**.
9. Under **Select Conversion Tracking Method**, choose **Conversion Tracking API - S2S**. Copy the conversion URL TrafficFactory shows. It has this shape:

```text theme={null}
https://CONVERSION_DOMAIN/tag.php?goal=GOAL_ID&tag={conversions_tracking}
```

`CONVERSION_DOMAIN` and `GOAL_ID` are filled in for you. The goal ID is 32 characters, letters a–f and digits.

### Add it to the traffic source in ClickFlare

1. Back in the **New Traffic Source** form, scroll to **Passing conversion info to traffic source**.
2. Turn on **Traffic source postback URL** and paste the conversion URL from TrafficFactory.
3. Replace `{conversions_tracking}` with ClickFlare's `{external_id}`, braces included.
4. Add `&value={payout}` at the end, so TrafficFactory receives the conversion value.
5. In the dropdown on the left, choose the ClickFlare event that should fire the postback. Keep **Conversions** to send every conversion. If your final action is a custom conversion (for example `purchase`), choose that instead.
6. Click **Save**. You are back in the campaign editor with the TrafficFactory traffic source selected.

The result:

```text theme={null}
https://CONVERSION_DOMAIN/tag.php?goal=GOAL_ID&tag={external_id}&value={payout}
```

> [!WARNING]
>
> Replace `{conversions_tracking}` in the postback with `{external_id}`. `{conversions_tracking}` belongs in the campaign URL, where TrafficFactory fills it. In the postback, ClickFlare doesn't know it, sends it as literal text, and TrafficFactory answers *ERROR: Tag is invalid!*

Keep the conversion domain exactly as TrafficFactory shows it. Don't swap it for your own tracking domain.

To learn what each postback token does, see [How to Configure a Traffic Source S2S Postback URL](https://clickflare.com/docs/en/tracking/how-to-configure-a-traffic-source-s2s-postback-url.md).

### Pixel tracking

TrafficFactory also offers **Pixel Tracking**: a script you paste on the page where the conversion happens. It only works on pages you control and doesn't use ClickFlare's data. With ClickFlare, use the S2S method. TrafficFactory recommends it too.

## Step 3 – Finish the campaign and copy its URL

1. Name the campaign.
2. Set the **Cost Model** to **Not Tracked**, so ClickFlare uses the cost TrafficFactory passes. On CPM campaigns, read [Cost](#cost) first.
3. Choose **Redirect** or **Direct** tracking. Redirect is the usual choice.
4. Click **Next** and, on **Destination**, add your lander (optional) and your offer.
5. Save, open **Tracking**, select your own tracking domain and copy the **campaign URL**.

Check that the campaign URL contains `tag={conversions_tracking}` and `zone_id={zone_id}`. If `zone_id` has no token, go back to [Step 1](#fill-in-the-zone-id-row).

If you use a lander, its call-to-action must link to the ClickFlare **click URL**, not to the offer directly. Otherwise the visit reaches the offer without a ClickFlare click ID, and the conversion cannot be traced back to TrafficFactory.

See [Creating a Campaign in ClickFlare](https://clickflare.com/docs/en/campaigns/creating-a-campaign-in-click-flare.md).

## Step 4 – Create the campaign in TrafficFactory

1. In TrafficFactory, create your ad (creative) first.
2. Go to **Campaigns** and create a new campaign. Choose the campaign type, name it and set the bidding type.
3. Paste the ClickFlare campaign URL as the ad's destination URL.
4. Add a target: name it, set the targeting options and enter your bid.
5. Link your ad to the campaign and save.

Paste the URL exactly as ClickFlare gives it, with `tag={conversions_tracking}` intact. When you set the destination, TrafficFactory may also offer **+ ADD TOKENS**. You don't need it: the ClickFlare URL already contains the tokens.

## Step 5 – Test the integration

TrafficFactory has no test-conversion button. Test with a real click.

1. Run a small amount of traffic, or click your own approved ad.
2. Complete the offer the way a real visitor would.
3. In ClickFlare, open **Logs → Event Logs** and check that the visit has an External ID. It is a long string. If it is empty or reads `{conversions_tracking}`, the campaign URL is wrong.
4. Go to **Logs → Postback Status** and filter by the campaign. Check the request to TrafficFactory's `tag.php`.
5. In TrafficFactory, open **Statistics** and show the goal's column (G1, G2...) in the **Goals** section of the table.

TrafficFactory answers each postback with a short text response:

| Response | Meaning |
| - | - |
| **OK** | The conversion was registered. |
| **ERROR: This conversion has already been notified and saved.** | The goal counts **One Conversion** and this click already converted. |
| **ERROR: Tag is invalid!** | The click ID is missing or malformed. Check that the campaign URL has `tag={conversions_tracking}` and that the postback has `tag={external_id}`. |
| **ERROR: No tag data.** | The click ID is empty. |
| **ERROR: Goal ID is invalid.** / **ERROR: No Goal ID.** | The goal ID was edited or left out. Copy the URL again. |
| **ERROR: Conversion window is not respected.** | The conversion came after the goal's conversion window. Lengthen the window. |

***

## Tracking several events

TrafficFactory tracks each event as its own conversion goal, for example a signup and a sale. Each goal has its own goal ID, so each event needs its own postback.

```text theme={null}
https://CONVERSION_DOMAIN/tag.php?goal=SIGNUP_GOAL_ID&tag={external_id}&value={payout}
https://CONVERSION_DOMAIN/tag.php?goal=SALE_GOAL_ID&tag={external_id}&value={payout}
```

1. In TrafficFactory, create a conversion goal for each step. Give them orders 1, 2, 3... so they appear as G1, G2, G3 in **Statistics**.
2. In ClickFlare, create a [custom conversion](https://clickflare.com/docs/en/settings/custom-conversions.md) for each step, for example `signup` and `sale`.
3. On the TrafficFactory traffic source, click **+ Another postback URL** once per extra goal.
4. Map each postback to its ClickFlare event: `signup` to the signup goal's URL, `sale` to the sale goal's URL.

> **Rules for multi-goal postbacks**
>
> * One postback per goal. The goal ID decides where TrafficFactory counts the conversion.
> * Set each goal's **Conversion Value** to **Dynamic** if you send `value={payout}`.
> * **Statistics** can show eCPA per goal. Turn the goal columns on in the **Goals** section of the table.
> * If **Dynamic CPA** pricing is enabled on your account, the conversion URL also takes your secret key (`skey`) and a `cpa` value. Ask TrafficFactory before using it.

> **Sending only one event**
>
> If TrafficFactory should only learn from your final sale, keep a single postback and map it to that event. Earlier steps (leads, add to carts) still show in ClickFlare. They just don't reach TrafficFactory.
>
> To send a postback only for some conversions, for example only those above a certain payout, use **Event filter** under the postback to add conditions.

## Cost

The template passes cost. The `Cost` row sends TrafficFactory's `{actual_cost}` token, the actual CPM or CPC paid for each impression or click, and ClickFlare records it as the visit's cost.

On the campaign, set the **Cost Model** to **Not Tracked** so ClickFlare uses the cost passed in the URL.

> [!NOTE]
>
> On CPM campaigns, `{actual_cost}` may be a price per thousand impressions, which would make the cost per visit far too high. After launch, compare the **Cost** column with your TrafficFactory spend. If it doesn't match, switch the Cost Model to **CPC** and enter your bid per click. For CPM buying, enter your CPM bid divided by 1,000 as the cost value. A popunder impression is roughly one visit.

When the recorded spend differs from your TrafficFactory spend, correct it with a [manual cost upload](https://clickflare.com/docs/en/settings/manual-cost-upload.md). See [Cost Models](https://clickflare.com/docs/en/core-platform-concepts/cost-models.md).

## Delayed revenue

If you run search arbitrage (RSOC or AFD) behind TrafficFactory, the feed reports revenue hours or days after the click. Make sure the goal's conversion window is long enough. To pass that revenue to TrafficFactory once it arrives, see [Sending Delayed Revenue to Traffic Sources](https://clickflare.com/docs/en/advanced-tracking-configuration/how-to-send-delayed-revenue-to-traffic-sources.md).

***

## Troubleshooting

> **TrafficFactory answers ERROR: Tag is invalid! or No tag data.**
>
> * The campaign URL has no `tag={conversions_tracking}`: the External ID row was changed or removed. Restore it and copy the campaign URL again.
> * The postback still contains `{conversions_tracking}` instead of `{external_id}`.
> * The campaign URL in TrafficFactory was edited, or `{conversions_tracking}` was removed.

> **Conversions show in ClickFlare but not in TrafficFactory**
>
> * **Traffic source postback URL** is off, or still empty. The template has no postback URL: add it as shown in [Step 2](#step-2-set-up-the-postback).
> * **Disable sending postbacks to traffic source** is on in the campaign.
> * The goal column is hidden in **Statistics**. Turn it on in the **Goals** section.
> * The conversion came after the goal's conversion window.
> * The postback is mapped to a different event than the one the conversion logged. Check **Logs → Event Logs** to see which event was recorded.
> * Check **Logs → Postback Status** for the request and TrafficFactory's response.

> **TrafficFactory shows conversions with no value**
>
> * `&value={payout}` is missing from the postback.
> * The goal's **Conversion Value** is **No Value** or **Fixed**. Set it to **Dynamic**.

> **The Zone ID column is empty**
>
> The Zone ID row's **TS Token** is still empty. Enter `{zone_id}` as shown in [Fill in the Zone ID row](#fill-in-the-zone-id-row), then copy the campaign URL again. If other columns are empty, the URL was edited or pasted where TrafficFactory doesn't fill tokens. See [Traffic Source Tokens Arriving Empty](https://clickflare.com/docs/en/troubleshooting/tokens-arriving-empty.md).

For the general checklist, see [Conversions not showing](https://clickflare.com/docs/en/troubleshooting/conversions-not-showing.md).

***

**FREQUENTLY ASKED QUESTIONS**

> **Q1:** Can I use the same TrafficFactory traffic source for all my TrafficFactory campaigns?

**A1:** Yes. The postback is set once on the traffic source and every campaign using it sends conversions the same way. A goal can be used by several campaigns. Create a second traffic source only if a campaign needs different goals.

> **Q2:** Why do I add the postback myself?

**A2:** The template doesn't include a postback URL. The conversion domain and goal ID come from your TrafficFactory account, so you build the URL once per traffic source in Step 2.

> **Q3:** Why is it `tag` in both the campaign URL and the postback?

**A3:** TrafficFactory names its click ID parameter `tag` in the conversion URL, and the template uses the same name in the campaign URL. The postback side must stay `tag`.

> **Q4:** Should I use Redirect or Direct tracking with TrafficFactory?

**A4:** Redirect is the usual choice and works with every TrafficFactory format. Use Direct only if TrafficFactory must see your lander's domain as the destination. See [Direct Campaign Tracking](https://clickflare.com/docs/en/campaigns/direct-campaign-tracking.md).

> **Q5:** TrafficFactory's help points to EXADS documentation. Is that the same thing?

**A5:** Yes. TrafficFactory's advertiser platform runs on the EXADS ad server, so EXADS' advertiser guides describe the same screens: conversion goals, the Conversion Tracking API and the campaign tokens.

## Related

> **[Traffic source postbacks](https://clickflare.com/docs/en/tracking/how-to-configure-a-traffic-source-s2s-postback-url.md)**
>
> Every token you can use in a postback.

> **[Custom conversions](https://clickflare.com/docs/en/settings/custom-conversions.md)**
>
> Split leads and sales into separate events.

> **[Cost models](https://clickflare.com/docs/en/core-platform-concepts/cost-models.md)**
>
> How CPC, CPA and RevShare costs are calculated.

> **[Conversions not showing](https://clickflare.com/docs/en/troubleshooting/conversions-not-showing.md)**
>
> The general checklist when postbacks don't arrive.


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