> For the complete documentation index, see [llms.txt](https://docs.amply.tools/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.amply.tools/user-guide/campaign-goals.md).

# Campaign goals

A goal is the event that means a campaign worked: a purchase, a sign-up, a feature used for the first time, a property that changed. Bind goals to a campaign and its **Statistics** tab shows how many of the users who saw it went on to reach them.

**Use this when** you want to know whether a campaign changes what users do, not only how often it was shown. **Don't use this when** you need revenue: goals count users and events, never money, because purchases arrive in many currencies and stores report them differently. For revenue by campaign, tag your purchase events and read them in your own analytics, see [Purchases from campaigns in your analytics](https://docs.amply.tools/recipes/purchases-from-campaigns-in-analytics.md).

Goals are counted from events your app already sends to Amply, so they need no SDK update and no app release. Counting starts when you create the goal: events from before that moment don't count toward it, and campaign views from before goals were introduced in Amply weren't recorded for them.

## Create a goal

Open **Goals** in the **Management** section of the menu and click **New goal**.

1. **Name** it the way your team talks about it, for example *Bought Pro*.
2. Under **Goal event**, pick the event that reaches the goal. The picker lists the events your app sends, marked *(system)* or *(custom)*. You can also type a name the app hasn't sent yet.
3. Optionally add **parameters** to narrow it down, exactly as for a campaign trigger. One extra operator exists only for goals: **One of** matches any value from a list, for example `plan` is one of `pro`, `team`.
4. Click **Create goal**.

<figure><img src="https://1054862905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVDwzd9ZLJgvvnIADl8D%2Fuploads%2Fgit-blob-17d346d787f8ae3655a2fc8cd82e53e22f13f518%2Fgoal-create.png?alt=media" alt="The New goal dialog: name Purchase, reached when event Purchase occurs, with an option to add parameters"><figcaption><p>A goal is a name and the event that reaches it.</p></figcaption></figure>

A goal can be any of the events a campaign can be triggered by:

| Goal                                  | Event                                                                     |
| ------------------------------------- | ------------------------------------------------------------------------- |
| Bought a subscription                 | your purchase event, for example `PurchaseCompleted`                      |
| Bought one of the discounted products | `PurchaseCompleted` with `sku` **One of** your offer SKUs                 |
| Tried the new feature                 | the event the feature sends, for example `ExportUsed`                     |
| Turned the new feature on in settings | `CustomPropertyChanged` with `key` = `smart_sort` and `newValue` = `true` |
| Came back after a break               | `SessionStarted`                                                          |

`amply_campaign_id` and `amply_campaign_name` can't be used as goal parameters: they mark which campaign an event came from (see [The campaign mark](#the-campaign-mark)), not what the event is.

### Editing and archiving

* **Rename** a goal at any time; nothing is recounted.
* **Change its event or parameters**, and the new definition applies from that moment. Events before the change stay counted under the old definition, so a report spanning the change mixes both.
* **Archive** a goal to retire it. New events stop counting toward it and it leaves every campaign's **Goals** step. Reports for past dates keep their numbers.

## Bind goals to a campaign

The **Goals** step is the last step of the campaign form.

* **Primary goal**: the one number that says this campaign worked. You can leave it at **No goal**.
* **Secondary goals**: up to four more, reported next to the primary one. A secondary goal needs a primary goal.
* **Window**: for each goal, how long after a user sees or engages with the campaign a goal event still counts for it. Choose from 30 seconds to 30 days. The default is 24 hours.

<figure><img src="https://1054862905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNVDwzd9ZLJgvvnIADl8D%2Fuploads%2Fgit-blob-7f567398e24f8f7f4d50a7e41fd8028ac0183e7a%2Fcampaign-goals-step.png?alt=media" alt="The Goals step of a campaign: primary goal Purchase reached within 7 days, and an Add secondary goal button"><figcaption><p>The Goals step: a purchase within 7 days counts for this campaign.</p></figcaption></figure>

Pick the window from how long the decision takes. A paywall purchase happens within minutes, so 1 hour is honest. A feature announcement may take days to show up, so 3 or 7 days is more realistic. A window that is too wide credits the campaign with things users would have done anyway.

You can change goals and windows on a live campaign. Each view or engagement is judged by the goals and window that applied when it happened, so a change doesn't recount the past. A report that spans the change says so.

## Read the results

On the campaign's **Statistics** tab, each bound goal gets a block above the impressions chart, primary goal first. It covers the same dates as the impressions.

| Number                  | What it means                                                                                                                                                                                          |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Users saw**           | Users who saw the campaign, or engaged with it, in the period.                                                                                                                                         |
| **Users reached goal**  | Those of them whose goal event came within the window after seeing or engaging, or who named this campaign with the [campaign mark](#the-campaign-mark). The percentage is the share of **Users saw**. |
| **Median time to goal** | The middle value of the time from seeing or engaging with the campaign to a user's first goal event.                                                                                                   |
| **Goal events**         | Every goal event credited to the campaign. A user who reaches a repeatable goal twice counts twice.                                                                                                    |

**How users reached the goal** splits **Users reached goal** by the strongest evidence for each user, counted once, by their first goal event:

* **Explicit mark**: the goal event named this campaign.
* **After engagement**: the user engaged with the campaign before reaching the goal: its mini-app ran to the end of its flow, or its gated action completed.
* **After view**: the user only saw it.

A deep link campaign has no engagement step of its own: opening the link is how it is shown. To tell its tap-throughs apart, put the [campaign mark](#the-campaign-mark) on the goal event the linked screen leads to.

### What counts as a user

Users are counted **by device**. Someone who uses your app on a phone and a tablet counts as two users. A reinstall can count as a new one.

### Still accruing

A user who saw the campaign near the end of the period can still reach the goal within the window, so the numbers for recent dates can grow. The block says **Still accruing** until the window has passed for the whole period. Events sent while a device was offline also arrive late and are counted when they arrive.

### Campaign numbers don't add up

Each campaign counts its own users. If a user saw two campaigns and then bought, **both** campaigns count that purchase. That is the right answer for "did this campaign help?", but never add campaign numbers together to get a total.

For a total, use the **Goals** page.

## The Goals page: how much happens after Amply

The **After Amply campaigns** column on the **Goals** page answers a different question: of all this goal's events in the last 30 days, how many followed an Amply campaign?

Here every goal event is credited to **one campaign at most**. An event that names a campaign with the campaign mark goes to that campaign, if the user saw or engaged with it in the 30 days before. Otherwise it goes to the campaign that most recently reached the user, if the event came within that campaign's window. This is why the share is not the sum of the campaign reports.

Goal reports reach back 90 days. A period that starts earlier is shortened, and the report says so.

## The campaign mark

Time windows guess. When the app knows which campaign led to an event, it can say so: send the goal event with an `amply_campaign_id` parameter holding the campaign's id. Add `amply_campaign_name` too, so your own analytics can read it. The [recipe](https://docs.amply.tools/recipes/purchases-from-campaigns-in-analytics.md) shows the app code for every platform.

* A marked event counts for that campaign up to **30 days** after the user saw or engaged with it, whatever window you chose.
* A marked event from a user who hadn't seen the campaign in the 30 days before is **not counted**. The campaign's block shows how many such events there were, so you can find a broken mark.
* If the mark can't be read, the event is credited by the window rules instead. A warning sign on the **Goals** page lists why: the mark was sent twice, wasn't a single value, wasn't a campaign id, or named a campaign that doesn't exist or belongs to another project.

## Scenarios

**A paywall campaign.** Goal *Bought Pro* (`PurchaseCompleted`, `sku` One of your Pro SKUs), primary, window 1 hour. The deep link carries the campaign, and the app puts the campaign mark on the purchase. Purchases from the paywall show as *Explicit mark*. Users who closed it and bought from settings ten minutes later show as *After view*.

**A winback offer.** Goal *Bought the comeback discount* (`PurchaseCompleted`, `sku` = your discounted product), primary, window 3 days. Secondary goal *Opened the offer* (the event your offer screen sends when it opens), window 1 hour. If many users open the offer and few buy, look at the offer itself before widening the audience.

**A What's New announcement.** A mini-app story walks through the new feature. Goal *Tried smart sort* (`SmartSortUsed`), primary, window 7 days. Secondary goal *Kept it on* (`CustomPropertyChanged`, `key` = `smart_sort`, `newValue` = `true`). There is no purchase and no mark: the window does the work, and *After engagement* separates users who watched the story to the end from those who only saw it.

## Related

* [Creating a campaign](https://docs.amply.tools/user-guide/creating-a-campaign.md) — the form the Goals step belongs to
* [Purchases from campaigns in your analytics](https://docs.amply.tools/recipes/purchases-from-campaigns-in-analytics.md) — the campaign mark, in app code
* [Tracking events](https://docs.amply.tools/developer-guide/tracking-events.md) — sending the events goals are made of
* [Sessions and events](https://docs.amply.tools/user-guide/sessions-and-events.md) — see which events your app sends
