How do I trigger rewards with a custom event?

In this setup, a referral is only counted towards the reward if the custom event is triggered. For example, in a single-sided reward that requires 20 referrals with a "purchase" custom event, if the user has earned 30 referrals already the reward will not trigger until at least 20 of those referred people makes the purchase.  

Triggering a reward does not create a referral, nor does it create a reward. Triggering rewards simply records that a user did a custom action, and will evaluate whether any rewards need to be issued. The referral needs to be in place before triggering any pending rewards. 

To properly record a custom event, all you need is the email address of the referred user who did the action and the name of the action. You then have different ways to tell Prefinery that the event occurred to trigger the reward if the conditions are sufficient. 

Setting the Reward's Award Event to Custom Event

In the Reward Editor when creating a new reward in your account, set the Award Event to Custom Event and specify the name of the custom event. 

For example, if you want to reward someone only after they make a purchase on your site, you could input purchase as your event name. 

You can reuse the same event name when setting up multiple rewards and all will be triggered when the person completes the event.

Recording the Event

You'll need to tell Prefinery that the referred person has performed the custom event so we can associate that action with the referral. To do this, you can either use our REST API, Zapier integration or JavaScript Web API. 

a. Record event via our REST API

The API Rewards#trigger endpoint can be used to tell us that a person has performed the custom event. Simply send the person's email address and the name of the custom event to Prefinery to get it recorded and trigger the rewards if all conditions are met (i.e. there's enough referrals with corresponding custom events). 

b. Record event via our JavaScript Web API Beta

You can use JavaScript to tell us that a person has performed the custom event. Like with the REST API this allows the sending of the person's email address and the name of the custom event to Prefinery. To learn more, see the documentation on the prefinery('triggerRewards', data, callback) method.

c. Record event via Zapier or other supported automation tool

You can also use no-code automation tools like Zapier in order to tell us that a person has performed the custom event. Simply use the Trigger Rewards action event in your zap action step to send us the person's email address and the name of the custom event. 

If your no-code automation tool of choice doesn't have native support for a Trigger Rewards action but supports HTTP requests you can make use of our API to create your own custom action. For more details on this, please see: How to use the Prefinery API with No-code Automation Tools

Delivering the Reward

If all conditions are met to trigger the reward, it can then be delivered to the user. For more information on delivering the reward, please refer to: How do I deliver rewards?

Example Reward Setups

While a referral credit is given to the referrer when a friend signs up through their unique referral link, that referral does not count towards the reward goal until the friend also performs the action (custom event).

A. Single-Sided Reward (reward your users when they refer their friends)

Say a single-sided gift card reward is configured to be earned after 5 referrals and those 5 friends need to perform the action “purchase”. 

If the user refers 10 friends, no reward is earned until at least 5 of them perform the action. 

Here's a scenario: 

  • John needs to refer 5 friends, all having downloaded your app, to earn a reward. John shares his referral link on Facebook.
  • Maria, a friend, sees and clicks on John's link, and subsequently signs up. John now has earned 1 referral, but that doesn't count towards the reward yet.
  • Maria then downloads your app. You record this event (Maria's email address and custom event "download") and send it to Prefinery. Prefinery verifies that Maria is already a referral of John so we give John a credit of 1 out of the required 5 referrals for the reward.
  • Ben, another friend, sees and clicks on John's link, and also subsequently signs up. At this point, John now has earned a total of 2 referrals, but so far only 1 of those (Maria's) counts towards the reward.
  • But, Ben didn't download your app. This means John still only have 1 credited referral towards the reward which requires 5.
  • Eventually 4 other friends see and click on John's link, and subsequently sign up. All 4 also then downloaded your app. You send all 4 separate events to Prefinery and they got verified. John now has earned a total of 5 referrals that counts towards the reward, and so has triggered and earned the reward.

B. Double-Sided Reward (reward each referred user, then the referrer if they meet the required # of referrals)

This is an example of a double-sided reward where the referring user needs to refer 5 friends and each friend needs to perform the action “purchase” for the referrer to receive a $50 Coupon, and each referred friend gets a $10 Coupon. 

Until the referrer reaches 5 referrals, the reward will not trigger for him, but will keep triggering ($10 Coupon) for each of those referred friends that makes a purchase. On the 5th referral, the reward would trigger both ($50 Coupon) for referrer and ($10 Coupon) for the referred friend that makes a purchase. 

Here's a scenario following the example above: 

John needs to refer 5 friends. John refers the first friend, Maria. Maria performs the event “purchase”. You'd then call the Trigger Rewards method described in the Recording the Event section earlier with Maria's email address (e.g. “maria@email.com”) and custom event "purchase". The returned value is an array of 1 reward (that Maria gets a $10 coupon). 

Time goes by and now John has already referred 4 friends, each of which has purchased. Now, he’s referring the 5th friend, Sarah. When Sarah performs the event “purchase” two rewards will be issued ($50 to John and $10 to Sarah). In this event, when you call the Trigger Rewards method with “sarah@email.com” did “purchase”, the return value is an array of 2 rewards ($50 to John and $10 to Sarah). 

Can a referred friend trigger the reward again if they perform the custom event (purchase)? No. Prefinery rewards are primarily referral-triggered (besides the custom event when it becomes a requirement). When the referred friend triggered the reward for themselves, it required two things: a new referral and a performed custom event. When the same referred friend performs the custom event again, it will no longer trigger the reward since one of the requirements is missing: a new referral. This is because a referral only happens once between the referrer and the referred friend for the referral relationship to be established. 


For a complete walkthrough, see our guide How to Create a Referral Program like AirBnB.

Still need help? How can we help? How can we help?