> ## Documentation Index
> Fetch the complete documentation index at: https://docs.extole.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Create a Reward That Triggers on Event Data

<Info>
  ### Important Note

  Applies to **flow campaigns built on Extole's upgraded Flow Builder** (look for the flow
  icon next to the campaign name on the **Programs** page).
</Info>

## What you're trying to do

You want a reward to be issued **only when the triggering event carries certain data** — for
example, only reward when the purchase event includes `product_id = SKU-123`, or only when
`product_type = subscription`.

In Extole this is done with a **data-comparison rule** that reads a parameter off the incoming<br />event and compares it to a value. You attach that rule to the reward (or to the business event<br />that drives the reward) so the reward only issues when the data matches.

## How rewards and rules fit together

A reward in Flow Builder fires through a chain:

`product_id = SKU-123`

So "trigger a reward on data" means **adding a data condition somewhere in that chain**. You have
a few places to put it, and the choice matters:

| Where you add the rule                   | Effect when the data does **not** match                                           | Use when                                                                                      |
| ---------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| **Reward Rule** (on the reward)          | The business event is still recorded, but **no reward is sent**                   | You still want to track the outcome event/conversion for reporting, just not issue the reward |
| **Trigger Rule** (on the business event) | The business event is **not created at all**                                      | You don't even want to record the event unless the data matches                               |
| **Trigger Rule** (on the reward)         | **This specific reward does not fire** (other rewards on the same step still can) | One event can produce different rewards and you want to route by data                         |

For most "only reward when product X" requests, a **Reward Rule** is the right choice — you keep<br />full event tracking and only gate the payout. Use a **reward Trigger Rule** when a single step has<br />multiple rewards and the data decides which one fires.

***

## Option A — Gate the reward with a Reward Rule (recommended)

This issues the reward only when the event data matches, while still recording the event.

1. Go to the **Programs** page and find your campaign.
2. Click the **Manage Flow** icon for that campaign.
3. In Flow Builder, find the **Reward** node you want to gate (e.g. the friend reward on
   conversion, or a reward-for-action outcome).
4. Scroll to the **Reward Rules** section for that reward.
5. Click **+ New Reward Rule** and choose **Event Data Comparison**.
6. Configure the comparison:
   * **Event Data Parameter** — the parameter name as it arrives on the event, e.g. `product_id`
     (or `product_type`, `sku`, `order_value`).
   * **Comparison** — one of: *Equals, Does not equal, Is blank, Is not blank, Contains, Does not
     contain, Matches Regex, Does not match Regex*.
   * **Value** — the value (or regex) to compare against, e.g. `SKU-123`.
7. Give the rule a **descriptive name** like `Only reward for SKU-123` so it's easy to
   read in troubleshooting.
8. Click **Apply** to save.

Remember: **all** reward rules on a reward must pass for the reward to be granted (they combine
with **AND**). Don't add a data rule that unintentionally blocks the default risk/limit rules.

### Example: reward only for a specific product

* Event Data Parameter: `product_id`
* Comparison: **Equals**
* Value: `SKU-123`

Only events whose payload includes `"product_id": "SKU-123"` will issue the reward.

***

## Option B — Suppress the event entirely with a Trigger Rule

Use this when you don't even want to create the business event unless the data matches (e.g. only
record a conversion at all when `product_type = subscription`).

1. **Programs** → **Manage Flow** → open the **business event** step (e.g. *Converted*).
2. Turn on the **advanced filter** to reveal **Trigger Rules** (Trigger Rules are hidden until the
   advanced filter is on).
3. Click to add a **Trigger Rule** → **Event Data Comparison**.
4. Configure **Event Data Parameter**, **Comparison**, and **Value** exactly as in Option A.
5. **Apply**.

If the incoming event fails the trigger rule, Extole **does not create the business event**, so no
downstream reward, email, or reporting step happens for it.

***

## Option C — Route to a specific reward with the reward's Trigger Rules

Use this when a single outcome/business event can produce **more than one reward** and you want
*this* reward to fire only when the data matches. For example, two rewards on the same conversion<br />step where the product decides which reward is issued.

This rule lives on the **Reward's Trigger Rules** and uses **Event Data Comparison**.

1. **Programs** → **Manage Flow** → select the **Reward** in the flow.
2. Under the reward's **Trigger Rules**, click **+ New Reward Rule**.
3. Select **Event Data Comparison** and give it a descriptive name (e.g. `Trigger only for SKU-123`).
4. Configure:
   * **Event Parameter** — the business-event data name, using **underscores instead of spaces**
     (e.g. a `Product ID` is referenced as `product_id`).
   * **Comparison** — Equals, Does not equal, Contains, Matches Regex, etc.
   * **Value** — the value to match, e.g. `SKU-123`.
5. Click **Apply**.

If the reward's trigger rule fails, **this reward does not fire** (other rewards on the same business event,<br />each with their own trigger rule, still can). This is how you route different data values to<br />different rewards on one event.

> **The parameter must exist as business-event data on the outcome step.** If it isn't there yet,
> add it first: click into the outcome step → **+ New Data** → **Business Event Data**, and name it<br />to match the field you send. Then reference it in the reward's trigger rule as the **Event Parameter** (spaces → underscores).

### Example: two rewards on one event, routed by product

* Reward A → Trigger Rule: **Event Data Comparison**, Event Parameter `product_id`, **Equals**, `SKU-123`
* Reward B → Trigger Rule: **Event Data Comparison**, Event Parameter `product_id`, **Equals**, `SKU-999`

The conversion event fires the matching reward based on the product id it carries.

***

## Prerequisite: the data must actually be on the event

A data rule can only compare a parameter that is **sent on the event**. Before configuring the
rule, confirm your integration includes the field:

* **JS tag / API:** include the parameter in the event `data`, e.g.
  `{ "event_name": "conversion", "data": { "product_id": "SKU-123", "cart_value": "129.00" } }`.
* **Batch file:** include a column for the parameter and map it to event data.

The **Event Data Parameter** name in the rule must match the parameter name you send, exactly<br />(names are case/spelling sensitive). If the field isn't present, **Equals** will fail and<br />**Is blank** will pass.

***

## Troubleshooting

* **Reward never issues, even for matching data.** Check that the parameter name in the rule
  matches the parameter you send (spelling/case), and that the value matches the comparison type
  (e.g. **Equals** is exact — capitalization and punctuation must match).
* **Reward issues for everything.** The data rule may not be on the reward — confirm it's listed
  under that reward's **Reward Rules**, not on a different reward or event.
* **Event isn't even recorded.** You may have added the rule as a **Trigger Rule** (which suppresses
  event creation) when you meant a **Reward Rule** (which only gates payout). Move it accordingly.
* **List/array field never equals.** Switch **Equals** to **Contains** or **Matches Regex**.

<br />
