> For the complete documentation index, see [llms.txt](https://help.openloyalty.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.openloyalty.io/campaigns/campaigns/campaign-simulation.md).

# Campaign Simulation

Learn how you can check the expected campaign outcome.

The **Campaign simulator** runs a scenario — a purchase, a return or an event for a member — against your active campaigns and shows which ones apply: the points per campaign and wallet, the rewards granted and the loyalty cost. Nothing is saved to real members, so you can check that a campaign has the right conditions before members start earning from it.

Go to **Campaigns › Direct** and click **Campaign simulator**. The first time you open it, a short tutorial walks you through the page; you can reopen it from the **⋮** menu at the top right.

<figure><img src="https://2658975168-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNVX03KZzmrGwJihLiEx%2Fuploads%2Fgit-blob-0002e70dc73c366154353e4ff7b591bf5723aa8c%2Fimage.png?alt=media" alt="Campaign simulator with the Trigger section (Purchase, Return, Internal event, Custom event) and the Transaction basket"><figcaption></figcaption></figure>

{% hint style="info" %}
Results reflect your campaigns as they are on the day you simulate.
{% endhint %}

***

## 🛠️ Build a scenario

{% stepper %}
{% step %}

### Pick a trigger

Under **Trigger**, choose what the simulator sends in:

* **Purchase** — a basket that was bought.
* **Return** — a basket sent back; its effects reverse.
* **Internal event** — an event raised by Open Loyalty.
* **Custom event** — an event sent by an integration.

Purchases and returns match campaigns on their basket, events on their name.
{% endstep %}

{% step %}

### Build the transaction or event

For a purchase or a return, fill the **Basket** in one of three ways:

* **Start from a document** — pick a real purchase or return from the last 90 days. Its lines become the basket.
* **Add from the catalog** — add products from your [Product Catalog](/integrations-and-data-exchange/product-catalog.md), searching by SKU.
* **Add line by hand** — type a line yourself. Typed lines can use any SKU.

Change a line with **Edit**, or its quantity with **−** and **+**. A basket needs a transaction number and date: a document brings its own, otherwise the simulator asks you to add them. Under **Transaction custom attributes**, add the data an integration would send with the transaction, such as a promotion code or a store flag.

<figure><img src="https://2658975168-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNVX03KZzmrGwJihLiEx%2Fuploads%2Fgit-blob-6b121565d308044bd61ab814fc1729f28394ea66%2Fcampaigns-campaign-simulation-2.png?alt=media" alt="Basket started from a real purchase: four product lines with prices and quantities, 1,036.00 USD in total"><figcaption></figcaption></figure>

For an internal or custom event, choose the event and fill in its attributes.
{% endstep %}

{% step %}

### Describe the member

Under **Member**, say who the event happened to:

* **Start from a member** — search for a real member by first name, last name, email, phone, card number or ID, and copy their details: tier, segments, transaction history, unit balances and agreements.
* **Add details** — set only the fields the campaign checks.

You can change any copied field before simulating. Blank fields count as unknown, not as false. Under **Member custom attributes**, add data an integration stores on the member, such as a partner ID or a signup source.
{% endstep %}

{% step %}

### Add the referrer (referral campaigns only)

Under **Referrer**, add the member who referred the member above. It's only needed when a campaign rewards referrals.
{% endstep %}

{% step %}

### Simulate

Click **Simulate**. The report appears above the scenario, which stays on the page so you can change it and simulate again. **Reset** clears the whole scenario.
{% endstep %}
{% endstepper %}

***

## 📊 Read the report

<figure><img src="https://2658975168-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNVX03KZzmrGwJihLiEx%2Fuploads%2Fgit-blob-1ae962fe15ef56a9b25592737fbf0f87dc3e7861%2Fimage%20(851).png?alt=media" alt="Simulation report: total and points loyalty cost tiles, then points per campaign for each wallet"><figcaption></figcaption></figure>

* **Total loyalty cost** — the cost of everything the scenario grants, across effects and rewards.
* **Points loyalty cost** — the cost of the campaign effects that grant units, across every wallet. Both are calculated from each wallet's [cost per unit](/members-and-activity/wallets/wallet-types-and-configuration.md#cost-per-unit).
* **One table per wallet** — each campaign that applied, with its **Points**, **Multiplier** and **Total**.
* **Rewards granted** — the rewards campaigns would issue. Other effects, such as custom attributes set or removed, are listed too.

{% hint style="info" %}
When several campaigns are activated by the same trigger, they are executed in order of their Campaign Start Date, with the earliest one being executed first.
{% endhint %}

{% hint style="warning" %}

* Automation campaigns can't be simulated.
* The simulator doesn't apply [per-rule limits](/campaigns/campaigns/campaigns-and-referral-campaigns/rule-limits-and-rule-resolution.md); it does apply the rule resolution.
  {% endhint %}

***

## 🕘 History

The **History** tab lists your last 10 simulations with their trigger, date, member and referrer. Click a run to open it again in the simulator, delete one with the bin icon, or remove them all with **Clear all**. History is kept in your browser for each tenant, so other admins don't see it.

<figure><img src="https://2658975168-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNVX03KZzmrGwJihLiEx%2Fuploads%2Fgit-blob-365f3d9b62f54e8642ceb2287acf3c31629b6c06%2Fcampaigns-campaign-simulation-4.png?alt=media" alt="History tab with one purchase simulation"><figcaption></figcaption></figure>

{% hint style="info" %}
Through the API, the same simulation is available as `POST /api/{storeCode}/campaign/simulate`. Include the member's `customerId` in the payload to use the member details stored in Open Loyalty.
{% endhint %}


---

# 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://help.openloyalty.io/campaigns/campaigns/campaign-simulation.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.
