# Limit the number of times a reactor can be triggered in a period of time

## Introduction

You can limit the number of times a reactor runs per user or program using [Activation limits](/product/loyalty-engine/reactors/activation-limits.md). When using an activation limit, the limit applies to the number of times a reactor has run in its current form across all time.

If you want to limit a reactor to only run a number of times in a particular period, you can use audiences to achieve this effect. For example, imagine you want to create a reactor which only runs once per week per user. This tutorial provides information on how to achieve this effect.

***

## Tutorial

{% hint style="warning" %}
Ensure that the event type you're working with has the [Audience enhancer](/product/loyalty-engine/events/event-types/event-enhancers.md#audiences) enabled.
{% endhint %}

{% hint style="info" %}
This tutorial uses a specific example of an end-user only being able to get a reward for using the promo code 'ONEPERWEEK' once every 7 days. However the logic can be applied to a broad range of scenarios.
{% endhint %}

#### Audience Configuration

1. Navigate to Users > Audiences. Click 'Create' in the top right corner.
2. Give the audience a name and description. Switch AUDIENCE\_JOINED and AUDIENCE\_LEFT events on if needed. Set the 'Refresh rate' to 'Daily Reactive'.
3. Move to the criteria tab. Click 'Add Group. Configure the criteria as follows.
   * Event type is SUBMITTED\_CODE
   * Event payload matches JSON schema&#x20;

     ```json
     {
       "type": "object",
       "$schema": "http://json-schema.org/draft-06/schema#",
       "properties": {
         "code": {
           "const": "ONEPERWEEK"
         }
       }
     }
     ```
   * Event occurrence count is 0
   * Reported at is later than time ago 7 days ago
4. Click 'Save'.

<figure><img src="/files/Pc8Tkopn3bXvp1i8Xvkk" alt=""><figcaption><p>The completed audience criteria.</p></figcaption></figure>

#### Reactor Setup

1. Navigate to Events > Reactors. Click 'Create' in the top right corner.
2. Give the reactor a name and choose SUBMITTED\_CODE from the event type list. Set an activation limit if needed.
3. Move to the payload constraints tab. Click 'Constant' in the Code section and enter 'ONEPERWEEK'. Click 'Is Audience' and select the audience you made in the previous step.
4. Move to the 'Reactions' tab and configure the reaction you need. See the [Activation limits](/product/loyalty-engine/reactors/activation-limits.md) article for more information.
5. Move to the 'Effectivity' tab and set a start date and an end date for the reactor, if needed.
6. Click 'Save'.

<figure><img src="/files/D3TNMxILIs5wg6pp3Tyz" alt=""><figcaption><p>Adding the audience constraint to the reactor.</p></figcaption></figure>


---

# 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/reactors/reactor-tutorials/limit-the-number-of-times-a-reactor-can-be-triggered-in-a-period-of-time.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.
