Define your first condition
If rewards are the motivation your users need to take a particular action, conditions are the way we track whether your user took the action. Conditions are made based on the events your application emits when users take actions in your app. A condition is satisfied for a particular user when Resonance receives the specified event for that user.
A condition can also serve as entry criteria for an offer or referral campaign. We'll talk about that more in the offer campaign and referral campaign guides.
Example: a simple condition
The most basic condition you can create is one that is satisfied the moment an event is fired for
a user. In this example, we have a condition that checks to see whether a user has fired the User Activated
event, which, like its name suggests, is an event that fires when a user "activates" in your app.
As soon as they do, and Resonance receives the event, the user will be eligible to receive their reward
(assuming they were a recipient of the offer with this condition in the first place).
Example: a condition with extra stipulations
Sometimes you want a condition that still looks at a single event, but you want to verify more
than just that the event was fired. Let's say for instance that you're offering a 10% discount on
a user's next purchase, but only if they have made three purchases in the past. You might fire an
event called Purchase Completed
every time the user makes a purchase, and then in
your condition, you can look for the Purchase Completed
event with a minimum receive count
of 3 (meaning we need to have seen this event at least three times for this user for the condition
to be satisfied).
Example: a combo condition
Conditions can also be combined using the connectives AND
and OR
. If
subconditions A and B are joined with an AND
, the condition says that both
subconditions A and B must be satisfied for the whole condition to be satisfied. If they're joined
with an OR
, then either subcondition A or subcondition B may be satisfied for the
whole condition to be satisfied.
After combining subconditions A and B into a new condition, C, you are then free to use C as a subcondition in yet another condition, D. You're free to create conditions that are as complex as you'd like, though in practice you would do well to avoid making overly complicated conditions. The more complex they become, the more likely they are to have bugs or to stop working as your application changes. Plus the more complicated a condition is, the harder it will be for new team members (for for future you) to understand!
Next steps
Conditions are the requirements users must fulfill to receive their rewards, so it's important to build conditions that actually reflect the actions you want your users to take. With that, we're ready to create our first offer or referral! As we progress, we'll also learn how to use conditions to dynamically make offers to users, and how they can be used to determine which referral campaign a sender will be part of.
Please also see the conditions API endpoints if you want to work with conditions outside of the console: