# Set up paid traffic

> From a tracking domain to ROAS: one campaign set up step by step, with sales reported back to the network.
> Source: https://www.eventsiq.io/docs/guide-paid-traffic


This guide sets up the whole loop for one ad campaign: the ad link records the click, the lead
knows which ad it came from, the sale is reported back to the network, and Reports show spend
next to revenue.

It takes about twenty minutes, most of it waiting for DNS. If you want the ideas first, read
[How click tracking works](https://www.eventsiq.io/docs/click-tracking).

:::note{title="What you'll need"}
-   A EventsIQ form that is already routed. If you do not have one yet, start with
    [Your first website form](https://www.eventsiq.io/docs/website-form).
-   A landing page where that form is embedded.
-   Access to your domain's DNS settings, to add one CNAME record.
-   An ad account on Meta, TikTok, Snapchat, Google, Microsoft Ads, NewsBreak or AppLovin that you
    can log in to.
:::

## The setup at a glance

```mermaid
flowchart LR
    subgraph once [Once per account]
        direction TB
        A[1. Tracking domain] --> B[2. Connect the ad account]
        B --> C[3. Traffic source]
        C --> D[4. Postback events]
        D --> E[5. Integrations]
    end
    subgraph each [For each campaign]
        direction TB
        F[6. Campaign] --> G[7. Link in the ad]
        G --> H[8. Test it]
        H --> I[9. CRM postbacks]
        I --> J[10. Watch the numbers]
    end
    once --> each
```

Steps 1, 4 and 9 are optional. Without a tracking domain your campaign sends clicks straight to your page, and
without postbacks only sales made inside EventsIQ's waterfall are reported.

## Step 1: Add a tracking domain

A tracking domain is a subdomain of yours that your ad links point at. Using your own domain keeps
the link trusted by browsers and ad networks, and lets EventsIQ record every click.

1. Go to **Settings → Domains** and click **Add domain**.
2. Type a subdomain, for example `track.yoursite.com`. A bare domain like `yoursite.com` is refused,
   because it would take over your whole site.
3. Open the new row. Under **Add this record at your DNS provider** you will see a **CNAME** record.
   Copy its **Name** and **Value** into your DNS provider.
4. Come back and click **Check again**. The status moves from **Waiting for DNS** to **Issuing
   certificate** to **Live**.

![Adding a tracking domain](https://www.eventsiq.io/docs-media/guide-paid-traffic/01-add-domain.png "Settings, Domains, with one domain expanded showing the CNAME record to add. Blur nothing, the target is not secret.")

:::tip{title="Namecheap, GoDaddy and similar"}
Some providers add your domain to the name for you. If yours does, enter just the first part, for
example `track`, not `track.yoursite.com`. The row tells you when this applies.
:::

:::note{title="DNS can take a while"}
Most records are picked up in a few minutes, some take an hour. The status only refreshes when you
click **Check again**, so click it again after a few minutes.
:::

## Step 2: Connect the ad account

Go to **Acquire → Connections**, click **Connect an account** and pick the network.
Log in and approve everything the network asks for. NewsBreak and AppLovin have no sign in window:
you paste an Access Token for NewsBreak, or three keys for AppLovin, instead. EventsIQ uses this one
connection to read spend and to send conversions.

![The Connections page](https://www.eventsiq.io/docs-media/guide-paid-traffic/02-connections.png "Acquire, Connections, with at least one Meta, TikTok or Google connection listed and its status Active.")

See [Connections](https://www.eventsiq.io/docs/connections) for what each network's grant is used for.

## Step 3: Create a traffic source

A traffic source describes one ad network: which network it is, the currency it reports spend in,
and which of its macros fill which EventsIQ field.

1. Go to **Acquire → Traffic sources** and click **New traffic source**.
2. Give it a **Name**, for example `Meta - Solar US`.
3. Pick the **Network**. The **Parameters** table fills itself with that network's macros, such as
   `{{campaign.id}}` for Meta or `{campaignid}` for Google.
4. Pick the **Reporting currency**: the currency your ad account is billed in.
5. Save.

![Creating a traffic source](https://www.eventsiq.io/docs-media/guide-paid-traffic/03-traffic-source.png "The New traffic source sheet with Meta selected and the Parameters table filled with Meta's macros.")

:::important{title="Keep the campaign id row"}
The campaign id is what joins spend to leads. You can add, rename or remove other rows, but keep
the one that fills **campaign_id**, or Reports cannot match this network's spend to anything.
:::

## Step 4: Define your postback events

Skip this step if every sale happens inside EventsIQ's waterfall. Do it if your CRM decides later
whether a lead became a sale.

1. Go to **Settings → Postbacks**.
2. Under **Events**, click **Add event**.
3. **Name your CRM sends**: the word your CRM will put in the postback, for example `sold`.
4. **What to call it here**: a readable name, for example `Sold`.
5. **Value**: **Whatever the CRM sends**, **The same every time** (then fill in **Amount**), or **No
   value at all**.

![Postback events](https://www.eventsiq.io/docs-media/guide-paid-traffic/04-postback-events.png "Settings, Postbacks, showing Your postback link at the top and the Events list. The key is shown as YOUR_KEY.")

Leave this page open. You will need **Your postback link** at the top in step 9.

## Step 5: Create the integrations

Integrations decide where EventsIQ sends conversions and where it reads spend from. Go to
**Acquire → Integrations**.

### Cost tracking

1. Open the **Cost tracking** tab, click **New integration** and pick **Cost tracking**.
2. Pick the **Traffic source** from step 3 and the **Connection** from step 2.
3. Tick the **Ad accounts** to read. TikTok calls them **Advertiser accounts**.
4. Leave **Run every** at 60 minutes unless you have a reason to change it, and save.

### Conversion API

1. Open the **Conversion API** tab, click **New integration** and pick **Conversion API**.
2. Pick the same **Traffic source** and **Connection**.
3. Choose where conversions go: a **Pixel** for Meta, TikTok or Snapchat, a **Google Ads account**
   for Google, or the ad account for Microsoft Ads or NewsBreak. AppLovin uses the connection's pixel.
4. Under **Postback events**, add a row for each event from step 4 and say what the network should
   call it. For Meta that is usually `Purchase` or `Lead`. For Snapchat you pick from its list, for
   example `PURCHASE`. For Google you pick one of your **Import from clicks** conversion actions.
   For Microsoft Ads you pick an offline conversion goal, and for NewsBreak a Postback event. For
   AppLovin, map the one event that means a sale to `generate_lead`.
5. Save.

![A Conversion API integration](https://www.eventsiq.io/docs-media/guide-paid-traffic/05-conversion-api.png "The New conversion API sheet for Meta with a pixel chosen and one Postback events row mapping sold to Purchase.")

See [Integrations](https://www.eventsiq.io/docs/integrations) for every field.

## Step 6: Create the campaign

Go to **Acquire → Campaigns** and click **New campaign**.

### General

| Field                      | What to put                                                                          |
| -------------------------- | ------------------------------------------------------------------------------------ |
| **Name**                   | Something you will recognise in Reports, for example `Solar US - October`             |
| **Traffic source**         | The one from step 3                                                                   |
| **Form or webhook**        | The form this campaign's ads lead to                                                  |
| **Report sales to**        | The Conversion API integration from step 5                                           |
| **Landing page**           | The page the form is on. Click **Check** and EventsIQ confirms the form is really there |

![The campaign General tab](https://www.eventsiq.io/docs-media/guide-paid-traffic/06-campaign-general.png "New campaign sheet, General tab, every field filled in and the landing page check showing 'This form is embedded on that page.'")

### Where clicks go

1. Pick **Through your link domain** and choose your tracking domain. If you skipped step 1, leave
   it on **Straight to your page**.
2. Everyone goes to your landing page by default. To test two pages against each other, use
   **Split the traffic** and add the second page with a weight.
3. To send some visitors somewhere else, for example mobile visitors to a mobile page, click
   **Add rule**. Rules are checked in order and the first one that matches wins.

![The campaign Where clicks go tab](https://www.eventsiq.io/docs-media/guide-paid-traffic/07-campaign-destination.png "Where clicks go tab on Through your link domain, a tracking domain chosen, no rules, and Everyone else going to the landing page.")

Click **Looks good**. The campaign is saved and the **Preview** tab shows the path a lead will take.

### Tracking

Open the **Tracking** tab. The **Tracking URL** is the link that goes in your ad.

![The campaign Tracking tab](https://www.eventsiq.io/docs-media/guide-paid-traffic/08-campaign-tracking.png "Tracking tab of a saved campaign showing the full Tracking URL, the Campaign ID and the Click link.")

## Step 7: Put the link in the ad

| Network    | Where it goes                                                                                         |
| ---------- | ----------------------------------------------------------------------------------------------------- |
| **Meta**   | Paste the **Tracking URL** into the ad's **Website URL**. Do this on every ad in the campaign.        |
| **TikTok** | Paste the **Tracking URL** into the ad's destination URL.                                             |
| **Snapchat** | Paste the **Tracking URL** into the ad's website URL. Snapchat adds its own click id, `ScCid`, to each click. |
| **Google** | Pick **Straight to your page**. Keep your landing page as the **Final URL** and paste the **Parameters** into **Final URL suffix**. |
| **Microsoft Ads** | Paste the **Tracking URL** into the ad's **Final URL**. With auto-tagging on, Microsoft adds its own click id, `msclkid`, to each click. |
| **NewsBreak** | Paste the **Tracking URL** into the ad's landing page URL. NewsBreak fills in its click id, `newsbreak_cid`, on each click. |
| **AppLovin** | Paste the **Tracking URL** into the campaign's landing page URL. AppLovin adds its own click id, `aleid`, to each click. |

:::note{title="Why Google is different"}
Google Ads checks that an ad's final URL is on the same domain as the page people end up on, and adds
its own `gclid` to every click. Going straight to your page keeps the landing page as the final URL, and the
form on the page still records the click.
:::

:::tip{title="Instant forms need nothing pasted"}
If the campaign runs on a Facebook, TikTok, Google or Snapchat instant form, there is no link. Pick
the network's campaign under **Ad campaign** on the General tab instead, and the network names the
campaign on every lead it sends.
:::

## Step 8: Test it

1. Open the **Tracking URL** in a private browser window. You should land on your page.
2. Submit the form with test details.
3. Go to **Activity → Lead logs** and open the lead. **The click it came from** shows the
   campaign, the link and the click id.

![A lead with its click](https://www.eventsiq.io/docs-media/guide-paid-traffic/09-lead-click.png "Lead logs drawer for the test lead, scrolled to 'The click it came from'.")

If the panel says the click has not been recorded yet, wait a few seconds and reopen the lead. The
click joins the lead on its own.

## Step 9: Connect your CRM's postbacks

Copy **Your postback link** from **Settings → Postbacks**. It looks like this:

```
https://app.eventsiq.io/cv?click_id={click_id}&event=sold&value={value}&key=YOUR_KEY
```

Give it to your CRM, replacing `{click_id}` and `{value}` with however your CRM writes those. Your
CRM needs the click id, so pass it along when you send leads there: the token is
`{{runtime.eiq_click_id}}`. Bodies written with the older `{{runtime.formwork_click_id}}` still work.

To test it by hand, use the click id from step 8:

```bash
curl "https://app.eventsiq.io/cv?click_id=PASTE_CLICK_ID&event=sold&value=250&key=YOUR_KEY"
```

Then open **Activity → Conversion logs**. You should see a row for the postback and the event sent to
your pixel or Google Ads account. A second call with the same click id and event is answered but
not sent again, so a CRM that retries never reports one sale twice.

## Step 10: Watch the numbers

Go to **Reports**. It opens on **By ad campaign**: one row per campaign as the network names it.
Within an hour of the first spend sync, each row shows **Spend**, **Revenue**, **Profit** and
**ROAS**. Click **Sync spend** to pull spend right away.

![ROAS by ad campaign](https://www.eventsiq.io/docs-media/guide-paid-traffic/10-reports.png "Reports, By ad campaign, with the summary cards and rows of spend and revenue. Names and amounts blurred.")

To see the same numbers rolled up by your own campaigns, with tracked clicks and split tests, switch
**Group by** to **Campaign**.

## Troubleshooting

:::warning{title="Leads arrive with no campaign"}
-   The ad is pointing at the landing page directly instead of the **Tracking URL**.
-   The landing page drops query parameters on its way to the form, for example a redirect from
    `http` to `https` that loses them.
-   The form on the page is not the EventsIQ embed, so nothing reads `eiq_click`.
:::

:::warning{title="Spend shows but revenue is zero"}
-   The traffic source lost its **campaign_id** row, so leads carry no network campaign id.
-   For instant forms, the campaign's **Ad campaign** is not set.
-   The cost tracking integration reads a different ad account from the one the ads run in.
:::

:::warning{title="A postback answers but nothing is sent"}
Open **Conversion logs** and find the **Postback** row. Its reason names the missing piece: the event
is not defined, the campaign has no conversion integration, or the integration has no row for that
event.
:::

## Where to go next

-   [Campaigns](https://www.eventsiq.io/docs/campaigns): rules, split tests and every field on the sheet.
-   [Postbacks](https://www.eventsiq.io/docs/postbacks): event values, rotating the key and what each log row means.
-   [Reports](https://www.eventsiq.io/docs/reports): grouping, columns and how the numbers are calculated.
