How to track custom events and use them in referral campaigns? (Event Schema)

This guide shows you how to build a definition of an event which you can use to identify converted new customers (referred customers).

Add custom events 🤓

Custom events are built with the Event Schema in your Project Settings:

Finding event schema

Firstly, add definition of a new event. 

Adding new custom event

If you need any additional properties to send along with the event request, which are going to be included in the validation process, you can build proper schema definition from this configurator. Choose ADD ATTRIBUTE and define new property (name, type, optional/required checkbox). 

Event schema additional properties

Defining properties is an optional step. The properties which you will add to schema must be passed through API in the metadata object. However, be aware that in API request you will have to determine customer (new referred person) and referral object (it contains only one mandatory property - code, which is a referrer code passed along with the new customer). 

Here's a code sample with an example of a POST API request defining a custom event:

POST /events

{
  "event": "signed_up",
  "customer": {
    "source_id": "tom+referrer_3_4@voucherify.io",
    "email": "tom+referrer_3_4@voucherify.io",
    "name": "Tomasz Pindel",
    "metadata": {
    	"test": true
    }
  },
  "metadata": {
	"sign_up_date": "2019-01-25T14:30:00.000Z"
  },
  "referral": {
  	"code":"NRY"
  }
}<br>

Create a referral program 📣

With Event Schema defined and added to your API, you can use these custom actions as a reward trigger in referral campaigns. Follow the step by step guide and launch a referral program based on events defined in your Event Schema 🙋

referral-program