# TrafficStars

> Set up TrafficStars as a traffic source, send it your conversions, and pull your spend automatically.

This page shows you how to set up TrafficStars in Proferex: track its clicks, send it your conversions, and pull your ad spend automatically.

---

## Apply the template

Go to **Tracker → Traffic Sources**, click **Create Traffic Source**, then **Templates → TrafficStars**. The template fills in everything below. You only need to change the parts marked **You fill in**.

If you set it up by hand instead, copy the tokens exactly as written, including the curly brackets.

---

## Variable mappings

| Variable | URL parameter | TrafficStars token |
|---|---|---|
| External ID | `externalid` | `{click_id}` |
| Cost (CPC) | `cost` | `{cost}` |
| v1 Campaign ID | `campaign_id` | `{campaign_id}` |
| v2 Creative ID | `creative_id` | `{creative_id}` |
| v3 Spot ID | `adspot_id` | `{adspot_id}` |
| v4 Spot Name | `adspot_name` | `{adspot_name}` |
| v5 Site ID | `site_id` | `{site_id}` |
| v6 Site Host | `site_host` | `{site_host}` |
| v7 Category | `category` | `{category}` |
| v8 Keywords | `keywords` | `{keywords}` |
| v9 Referrer | `referrer` | `{referrer}` |
| v10 Device Type | `device_type` | `{device_type}` |

![The URL variable mappings filled in by the TrafficStars template, from External ID with click_id and Cost (CPC) with cost to v10 Device Type](/images/docs/trafficstars-mappings.jpg "The TrafficStars template fills in every row")

For **Cost (CPC)**, use `{cost}`, which is what TrafficStars actually charged for the click. Don't use `{price}`, which is your bid and can be higher.

---

## Postback URL

The template fills in this address:

```text
https://tsyndicate.com/api/v1/cpa/action?key=YOUR_SECRET_KEY&clickid={externalid}&goalid=0&value={payout}
```

![The TrafficStars adapter selected, its postback URL with YOUR_SECRET_KEY, and the Traffic source currency set to USD](/images/docs/trafficstars-postback.jpg "Replace YOUR_SECRET_KEY with your own key")

**You fill in:** replace `YOUR_SECRET_KEY` with the secret key from **Tracking & API** in your TrafficStars account. Leave the rest as it is.

---

## Cost sync

The template sets **Traffic Source Adapter** to **TrafficStars**.

![The TrafficStars API Key field, API Timezone set to UTC, and Campaign ID Token set to v1](/images/docs/trafficstars-api.jpg "Paste your API key. The rest is set for you")

- **You fill in:** paste your API key from the **Profile** page in TrafficStars into **API Key**.
- **API Timezone** is UTC, the timezone TrafficStars reports spend in. You cannot change it.
- **Traffic source currency** is USD, the currency TrafficStars reports in.
- **Campaign ID Token** is `v1`, the row that carries `{campaign_id}`. Keep it that way, or cost sync cannot match spend to your clicks.

**Don't want cost sync?** Set **Traffic Source Adapter** to **None (Manual Cost Tracking)** and leave the API key empty. Everything else keeps working, and each click's cost comes from the **Cost (CPC)** row instead. See [Costs](/docs/tracker/costs/index.md).

---

## Control the campaign from Proferex

Once cost sync is set up, click **API** at the top of a TrafficStars campaign's page in Proferex.

![The Traffic Source API Integration window for TrafficStars, with cost sync active, the CPM model, the traffic source campaign ID 4402118, and the Campaign Overview, Pause, and Resume buttons](/images/docs/api-trafficstars.jpg "Pause and resume the campaign at TrafficStars")

1. Under **Traffic Source Campaign ID**, pick the TrafficStars campaign. Proferex lists the IDs it has seen in `{campaign_id}` on this campaign's visits.
2. Click a button:
   - **Campaign Overview** opens the campaign's settings in TrafficStars, where you can block spots.
   - **Pause** and **Resume** pause and restart the campaign straight away.

To find the spots to block, group the campaign by **V3**, the spot ID. See [Campaign Reports](/docs/reports/campaign-reports/index.md#block-a-losing-spot-in-one-campaign).

---

## Next step

Save the traffic source, then create a campaign with it. See [Campaigns](/docs/tracker/campaigns/index.md).
