How to add custom attributes (metadata) to Voucherify objects?

In this section:

  1. Create a metadata - schema validation
  2. Create a campaign with schema validation
  3. Invoke redemption
  4. Target specific segments

What is 'metadata'?

Metadata enables you to add custom data to Voucherify, which you can later use for building validation rules and reporting/ tracking.  Every object type like:

  • vouchers
  • campaigns
  • customers
  • products
  • SKUs
  • redemptions
can have some attributes that are not built-in by default but you need them to customize promo campaigns. For example, you can add custom attributes to your customers, and segment them accordingly to attributes unique for your business model.
Moreover, metadata added to redemption object enables you to create limits for redemptions which are not possible with built-in validation rules. For example, taxi companies very often offer promo codes for rides booked at particular hours, redemption metadata enables them to create redemption rules based on time when the ride happens (redemption) and time when it was booked (custom metadata attribute).
There are plenty of use cases for metadata and each of them is unique. They give you extreme flexibility and freedom in creating rules and limits for promotions and segmentation of your customers. You can see some videos with metadata use cases here.
Let's take a look at Metadata Schema and learn how to create metadata attributes for Voucherify objects.

Add metadata with Schema

Schema validator allows you to take care of the integrity of your metadata. This is achieved by enabling administrators to set a type of each metadata field and to define if it’s optional or not. The schema works for every object type:

  • campaigns
  • vouchers
  • customers
  • SKUs
  • products
  • redemptions

Only Administrator can access and modify the validation scheme.


Create a metadata - schema validation

Let's see an example of the schema validator. We're going to add a custom field `affiliate_ID` to all campaign and redemption objects in the project.

1

To start with, go to the project settings and find Metadata - Schema section. 

2

Choose to edit the schema.

3

First, choose Voucherify objects to assign metadata. You can define properties for campaigns, vouchers, publications, redemptions, products, SKUs, customers, and orders. 

4

In the next step, define a property name and type. Let's use an affiliate_ID as a property assigned to the project's campaigns and redemptions.

While choosing property type, you can choose from text, number, flag (true/false), date and date time. 

5

Additionally, you can mark the checkbox to set each property as optional. Otherwise, it'll be treated as required. 

6
In the last step, you can add some optional length constraints or even set a condition that the metadata property has to be an exact match to the value (or many custom values).

One metadata property can be defined by many restrictions, and each restriction can be defined by many different values:

7

When all campaigns' restrictions are in place, confirm with ADD DEFINITION and SAVE your schema.

8

Now, let's define all redemptions invoked amongst this project by the same affiliate_ID


Run a campaign 

As a result, while creating a new campaign (by a user assigned to this project) in 5th step of a campaign creator, there will be a default metadata field with an affiliate_ID. To create a campaign, the user has to put the required property value, set by a project administrator in the validation schema.

Otherwise, the user won't be able to save and generate campaign.


Invoke redemption

Additionally, by adding the same restriction to a redemption invoked in the context of this project, a field with the particular affiliate_ID is required for a redemption request to be valid.

Note: In case you add properties (definitions/restrictions) to a campaign and a voucher object at once, in voucher's view you'll see a validation schema from a campaign and a voucher section.


Target specific segments

You can create metadata validation schema for "customer" objects and use it for a later segmentation. By way of example, you can add a date field to the schema and collect information about specific dates, e.g. date of signing up. 

After adding this field, you'll be able to filter out your clients by using a particular date Later on, you can easily create a segment with customers who meet criteria defined by schema properties.

Watch this short video to see the workflow step by step:

You can also follow this  guide to learn more about customer segments.