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. 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

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.

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

      {
        "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'.

The completed audience criteria.

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 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'.

Adding the audience constraint to the reactor.

Last updated

Was this helpful?