> For the complete documentation index, see [llms.txt](https://docs.mediarithmics.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mediarithmics.io/measurement-and-attribution/measure-and-optimize/track-your-campaign/campaign-tracking.md).

# Campaign tracking

Mirror a campaign served through another adserver, so its exposures land in your datamart.

## Your goal

Bring the impressions and clicks of a campaign you run through an external adserver into mediarithmics, without serving the creative yourself.

## Expected outcome

A mirror campaign in mediarithmics, with its exposed and clicker populations updating in real time.

## Why track a campaign this way

* Get insight into the population exposed to your campaign, and the population that clicked on it.
* Cross those populations with the audience you targeted.
* Retarget them with another message.
* Exclude them from a later campaign.

## What it produces

Triggering a pixel creates two segments automatically, named from your campaign.

<table data-search="false"><thead><tr><th width="280">Segment</th><th></th></tr></thead><tbody><tr><td><em>campaign_name</em> <strong>- Exposed</strong></td><td>Every UserPoint that was exposed to the campaign.</td></tr><tr><td><em>campaign_name</em> <strong>- Clickers</strong></td><td>Every UserPoint that clicked on the campaign.</td></tr></tbody></table>

Both are **Campaign segments**, documented in the **Audience & Activation** section under *Build your audiences > Segment reference > Segment types > Campaign segment*. They are populated in real time, and feeds activated on them share new users in real time too.

{% hint style="info" %}
The segment counts shown in the platform are only calculated once a day. To get the exact count at a given moment, query the segment directly:

```sql
SELECT @count{} FROM UserPoint where { segments { id = "1234" } }
```

{% endhint %}

You can filter the segment list by type to view only these segments.

## Set it up

{% hint style="danger" %}
Make sure beforehand that campaign auto-setup has been activated on your account. Check with your account manager, and ask them for your **Datamart Token** as well.
{% endhint %}

The objective is to generate the pixels you add to your banners: one pixel for impressions, and one tag for clicks.

{% stepper %}
{% step %}

### Decide your technical names

You must fill in at least a campaign technical name, a sub-campaign technical name, and a creative technical name.
{% endstep %}

{% step %}

### Generate the pixels

Campaign tracking uses the same `$ad_view` and `$ad_click` mechanism as ad exposure. The generation procedure and the exact pixel parameters are documented in the **Setup & Monitor** section, under *Collect & manage your data > Collect data in real time > Ads exposure tracking*.
{% endstep %}

{% step %}

### Add them to your banners

{% hint style="success" %}
**Good to know.** Some activation tools provide macros that let you integrate the pixels directly inside a template, and fill in the technical names automatically.
{% endhint %}
{% endstep %}
{% endstepper %}

## Attribute the conversions

Define [goals](/measurement-and-attribution/measure-and-optimize/track-your-campaign/goals-and-attribution.md) and link them to your mirror campaign to attribute conversions to it.

## Verify

* Triggering the pixel and the click tag creates the *Exposed* and *Clickers* segments for your campaign.
* Both segments populate in real time as impressions and clicks arrive.
* The technical names arrive resolved, not as raw unsubstituted macros.

## Related pages

<table data-view="cards" data-search="false"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Measure campaign performance</strong></td><td>Reading the delivery of this campaign over time.</td><td><a href="/measurement-and-attribution/measure-and-optimize/track-your-campaign/measure-campaign-performance.md">Measure campaign performance</a></td></tr><tr><td><strong>Goals and attribution</strong></td><td>Attaching a goal to this campaign to attribute its conversions.</td><td><a href="/measurement-and-attribution/measure-and-optimize/track-your-campaign/goals-and-attribution.md">Goals and attribution</a></td></tr><tr><td><strong>Display campaigns</strong></td><td>The other route: setting up a DCO campaign in mediarithmics.</td><td><a href="/measurement-and-attribution/measure-and-optimize/track-your-campaign/display-campaigns.md">Display campaigns</a></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.mediarithmics.io/measurement-and-attribution/measure-and-optimize/track-your-campaign/campaign-tracking.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
