How to add metadata (custom attributes) 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:

  • voucher
  • campaign
  • customer
  • product
  • SKU
  • redemption
  • publication
  • order
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 (e.g. base your customer segment on ice cream flavour preferences of your customers) πŸ¨
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 Metadata Schema βž•

Metadata Schema 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:

  • campaign
  • voucher
  • customer
  • SKU
  • product
  • redemption
  • publication
  • order

⚠️Only Administrator can access and modify the validation scheme 

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


To start with, go to the project settings and find Metadata - Schema section βž‘️

Creating metadata


Choose to edit the schema βœοΈ

Edit metadata schema


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

Different object for metadata


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. 

Adding new metadata

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

Different property types for metadata


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

Setting metadata to optional

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.

Metadata with many val rules


When all campaigns' restrictions are in place, confirm with UPDATE PROPERTY DEFINITION and SAVE your schema βœ…

Confirming metadata


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. 

Metadata in promotion campaign

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 membership field to the schema and collect information about membership levels to offer different incentives for different members.

membership level metadata

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

Customer segment based on metadata

Watch this short video to see the metadata in action πŸ“Ή

You can also follow this guide to learn more about customer segments πŸ“”

Still need help? Contact Us Contact Us