# Event enhancers

Event enhancers let you automatically add internal Loyalty Engine data to an event’s payload when that event is reported. This data is included in addition to whatever external data your system sends.

Use event enhancers when you want to build reactor conditions based on Loyalty Engine context — not just what your system provides.

***

## Why use enhancers?

Without enhancers, you can only build logic based on the data you provide when sending the event. With enhancers, you can include internal platform context to:

* Target reactors based on current user state (e.g. audience, tier)
* Trigger different outcomes for users with different points balances
* Avoid duplicating data in your own system just for event reporting

***

## How to enable

You can add event enhancers when configuring an event type in the Loyalty Console. Once enabled, the selected data will be automatically appended to every event payload of that type.

<div data-with-frame="true"><figure><img src="/files/CIqwMypHvpn06QPQ6CsS" alt="" width="563"><figcaption><p>Adding enhancers to a custom event type in the Loyalty Console</p></figcaption></figure></div>

***

## What data can be added?

The following enhancers add specific properties to the event payload **before** reactor conditions are evaluated and **before** duplicate detection is applied:

{% tabs %}
{% tab title="Audiences" %}

### Audience enhancer

The audience enhancer allows you to add data about a user’s audience memberships to an event’s payload. This enables you to create more targeted reactors by using audience-specific information to determine how a reactor should behave.

Enable the audience enhancer if you want to restrict reactors for the relevant event type to only apply to users who are, or are not, part of a particular audience.

> #### Example
>
> Imagine you’re running a double points promotion for users who joined your loyalty program in the last 30 days. By enabling the audience enhancer on your purchase event type, you can create a reactor that applies double points, but only to users in a “joined in the last 30 days” audience.

The event payload will include a list of audiences the user belongs to *before* the event is triggered. This allows reactions to consider the user’s pre-event audience memberships.

To learn more about audiences, see [Audiences](/product/loyalty-engine/audiences.md) and our tutorial on this: [Limit a reactor an audience](/product/loyalty-engine/reactors/reactor-tutorials/limit-a-reactor-an-audience.md).

### Audience enhancer properties

The following properties are added to an event payload when the audience enhancer is on:

<table data-full-width="false"><thead><tr><th width="158" valign="top">Property</th><th valign="top">Description</th></tr></thead><tbody><tr><td valign="top"><code>audience</code></td><td valign="top">A list of <code>audienceId</code>'s of the audiences the user is part of at the moment immediately before the event was reported.</td></tr></tbody></table>
{% endtab %}

{% tab title="Points" %}

### Points enhancer

The points enhancer adds data about a user’s points balance and earning history to an event’s payload. This allows you to build reactors that respond to specific points-related criteria, helping you target users based on their loyalty activity.

You might enable the points enhancer if you want to create reactors that:

* Only apply to users who have more or less than a specific points balance.
* Trigger for users who have earned, or not earned, a certain number of points within a particular time frame (e.g., day, month, year).
* Apply only to users based on their lifetime points earnings.

You could enable the points enhancer on an event type if you wanted to constrain reactors to:

* only apply to users who have under or over a specific points balance
* only apply to users who earned, or have not earned, a particular number of points in the current or previous day, month or year
* only to users who earned, or have not earned, a particular number of points in the lifetime of their loyalty account

> #### Example
>
> You could run a double points promotion for users who have earned fewer than 500 points in the current calendar year.

To find out more about points, see [Points](/product/loyalty-engine/rewards-and-points/points.md).

### Points enhancer properties

The following properties are added to an event payload when the points enhancer is on:

<table data-full-width="false"><thead><tr><th width="229" valign="top">Property</th><th width="470" valign="top">Description</th></tr></thead><tbody><tr><td valign="top"><code>points</code></td><td valign="top"><p>The user’s current points balance immediately before the event is reported. This does not include any points awarded by reactors triggered by the current event.<br></p><p>For example, if the user’s current balance is 1200 points and the event will result in an additional 400 points being awarded by reactors, the balance reported by this data point would still be 1200, as it doesn’t account for the points about to be rewarded.</p></td></tr><tr><td valign="top"><code>lastYearPoints</code></td><td valign="top"><p>The total points earned by the user in the previous calendar year.<br></p><p>For example, if an event is reported in 2024, this figure would represent the total points earned by the user during 2023.</p></td></tr><tr><td valign="top"><code>lastMonthPoints</code></td><td valign="top"><p>The total points earned by the user in the previous calendar month.<br></p><p>For example, if an event is reported in February 2024, this figure would represent the total points earned by the user in January 2024.</p></td></tr><tr><td valign="top"><code>last24HoursPoints</code></td><td valign="top"><p>The total points earned by the user in the 24 hours immediately preceding the event being reported.</p><p></p><p>For example, if an event is reported at 22:00 on 12 March 2024, this figure would represent the total points earned between 22:00 on 11 March 2024 and 22:00 on 12 March 2024.</p></td></tr><tr><td valign="top"><code>currentYearPoints</code></td><td valign="top"><p>The total points earned by the user in the current calendar year, excluding any points awarded by reactors triggered by the current event.</p><p></p><p>For example, if an event is reported on 12 March 2024, this figure would represent the total points earned between 1 January 2024 and the exact date/time the event is reported.</p></td></tr><tr><td valign="top"><code>currentMonthPoints</code></td><td valign="top"><p>The total points earned by the user in the current calendar month, excluding any points awarded by reactors triggered by the current event.<br></p><p>For example, if an event is reported on 12 March 2024, this figure would represent the total points earned between 1 March 2024 and the exact date/time the event is reported.</p></td></tr><tr><td valign="top"><code>userLifetimePoints</code></td><td valign="top">The total points ever earned by the user over the lifetime of their loyalty account, excluding any points awarded by reactors triggered by the current event.</td></tr></tbody></table>
{% endtab %}

{% tab title="Random number" %}

### Random number enhancer

Adds a random number between 0 - 1 to the event payload, to five decimal places: 0.00000 i.e. 0.75501.

You might enable the random number enhancer if you want to:

* Report events and avoid [duplicate event detection](/product/loyalty-engine/events/reporting-events.md#duplicate-event-detection) in almost all cases (there's a 1 in 100,000 chance the random number could be the same, though)
* Create reactors that only run based on a chance percentage (i.e. create a reactor condition where the random number must be **less than 0.5** to give it a 50% chance of running when an event matching the rest of the conditions is reported)

### Random number enhancer properties

The following properties are added to an event payload when the random number enhancer is on:

<table><thead><tr><th valign="top">Property</th><th valign="top">Description</th></tr></thead><tbody><tr><td valign="top"><code>randomNumber</code></td><td valign="top">A random number between 0 - 1 to five decimal places.</td></tr></tbody></table>
{% endtab %}

{% tab title="Code pool" %}
{% hint style="info" %}
Only relevant to customers using the [Codes](/product/modules/codes.md) module.
{% endhint %}

### Code pool enhancer

The code pool enhancer is automatically applied to the `SUBMITTED_CODE` event type if you are using the Codes module. This enhancer allows you to create reactors that are limited to specific codes from a defined code pool, based on the code included in the event’s payload.

To find out more about code pools, see [Codes](/product/modules/codes.md). This enhancer is **not** related to reward code pools.

### Code pool enhancer properties

The following properties are added to an event payload when the code pool enhancer is on:

<table data-full-width="false"><thead><tr><th width="216" valign="top">Property</th><th valign="top">Description</th></tr></thead><tbody><tr><td valign="top"><code>redeemedPoolId</code></td><td valign="top">The <code>id</code> of the code pool that the included code is part of.</td></tr><tr><td valign="top"><code>redeemedPoolName</code></td><td valign="top">The name of the code pool that the included code is part of.</td></tr></tbody></table>
{% endtab %}

{% tab title="Referrals" %}
{% hint style="info" %}
Only relevant to customers using the [Referrals](/product/modules/referrals.md) module.
{% endhint %}

### Referrals enhancer

The referrals enhancer allows you to create reactors that are triggered only for users whose accounts originated from a referral campaign. This enhancer adds referral-related data to the event’s payload, letting you target users who signed up using a referral link.

You might enable the referrals enhancer if you want to reward users for an event only if they signed up through a referral campaign.

> #### Example
>
> You could run a double points promo for users who signed up via a referral code.

To find out more about referral campaigns, see [Referrals](/product/modules/referrals.md).

### Referrals enhancer properties

The following properties are added to an event payload when the random number enhancer is on:

<table data-full-width="false"><thead><tr><th width="281" valign="top">Property</th><th valign="top">Description</th></tr></thead><tbody><tr><td valign="top"><code>campaignId</code></td><td valign="top">The referral campaign ID the user (whose event this is) is part of through the referral code they used during signup. If this is empty, then the other fields would be empty too since they didn’t sign up via a referral code.</td></tr><tr><td valign="top"><code>referralId</code></td><td valign="top">For internal use.</td></tr><tr><td valign="top"><code>referralCodeId</code></td><td valign="top">For internal use.</td></tr><tr><td valign="top"><code>isCampaignActive</code></td><td valign="top">The status of the referral campaign (true/false) the use signed up with at the time this new event occurs. This can be used to not react to events if the campaign is now inactive.</td></tr><tr><td valign="top"><code>referralCodeInviteCode</code></td><td valign="top">The referral URL used by the user when registering.</td></tr><tr><td valign="top"><code>referralTrancheStatuses</code></td><td valign="top"><p>A collection of statuses of each referral ‘sequence step’ (eg Signup, Make 2 Purchases, etc) completed by this user. This includes the following details:<br><code>trancheId: string; // sequence step id activations: number; // number of times sequence completed (for eg, if 1 purchase made out of 2 required purchases, activation would be '1'</code></p><p><code>isCompleted: boolean; // is the sequence completed? (For eg, false if only 1 purchase is made and we are waiting for the 2nd purchase)</code></p></td></tr></tbody></table>
{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kbase.whitelabel-loyalty.com/product/loyalty-engine/events/event-types/event-enhancers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
