
Tiered loyalty programs are a way to reward customers based on their level of interaction with your brand. We can help you create a structure that allows all members to enjoy benefits, but also ranks them into groups based on the total transaction value. This creates an environment of member engagement and loyalty that increases word-of-mouth recommendations and customer lifetime values.

#### Use case assumptions

- Loyalty program is created for customers who have created an account (online and/or in point of sales (POS)). 
- Customers will be assigned to one of the four levels (tiers) of the loyalty program based on the total balance value (transactions value minus the value of returns) from the last 365 days.
    1. White (transactions under 300 PLN)
    2. Green (transactions from 300 PLN to 999,99 PLN)
    3. Silver (transactions from 1000 PLN to 1999,99 PLN)
    4. Golden (transactions above 2000 PLN)

- Making a transaction of a specific amount lets you go automatically to the higher level. 
- Being in the specific group makes it possible to use specific discounts for your shopping (it can be for example 5% for Green, 8% for Silver, and 10% for Golden). 
- The process involves creating an expression that returns the number of the tier to which a customer belongs: 1 for White, 2 for Green, 3 for Silver, 4 for Golden. Further on, we create a segmentation that is divided into four segments (White, Green, Silver, Golden); the customers are assigned to each segment based on the result of the expression. You can use these segments in your communication.



## Prerequisites 
---
- Implement transaction events using [SDK](/developers/web/transactions-sdk) or [API](https://developers.synerise.com/DataManagement/DataManagement.html#operation/CreateATransaction). 
- Implement the [custom event](/developers/web/event-tracking#declarative-tracking-custom-events) which is sent to Synerise when a customer joins a loyalty program (for example, the `loyaltyStatus` event with a `status` parameter set to `active`). Such an event with the appropriate status must be sent each time the membership status changes (when the customer resigns from the program or joins again).
    
  <div class="admonition admonition-note"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg></div><div class="admonition-body"><div class="admonition-content">

  In this case, when a customer joins the loyalty program, a custom event is generated on their profile card. However, these conditions and the scenario can be adapted to your business needs, for example, you can count the customers who joined the loyalty program using the registration event in the mobile application or on the website.

  </div></div></div>

- Implement the [custom event](/developers/web/event-tracking#declarative-tracking-custom-events) which is sent to Synerise when a customer returns products (for example, the `product.return` event with the `$totalAmount` parameter that contains the value of products which are returned). Such an event with the appropriate parameter must be sent each time the customer returns the products.

## Process 
---
The process of creating the tiered loyalty program based on the transactions value is divided into the following steps:

1. [Prepare an aggregate which returns the time of joining the loyalty program](/use-cases/loyalty-color-schemas#prepare-an-aggregate-which-returns-the-time-of-joining-the-loyalty-program).
2. [Prepare an aggregate that counts the total transaction value](/use-cases/loyalty-color-schemas#prepare-an-aggregate-that-counts-the-total-transaction-value).
3. [Prepare an aggregate that counts the value of returns](/use-cases/loyalty-color-schemas#prepare-an-aggregate-that-counts-the-value-of-returns).
4. [Prepare an expression counting the balance](/use-cases/loyalty-color-schemas#prepare-an-expression-counting-the-balance) of a customer (transaction value minus the value of returns).
5. [Prepare an expression that returns the tier number](/use-cases/loyalty-color-schemas#prepare-an-expression-that-returns-the-tier-number) to which a customer belongs to.
6. [Create a segmentation of customers in tiers ](/use-cases/loyalty-color-schemas#create-a-segmentation-of-customers-in-tiers) of customers based on their loyalty level, which you can use to analyze the number of customers in tiers.

## Prepare an aggregate which returns the time of joining the loyalty program
--- 
Start with creating an aggregate that returns the time of the first occurrence of the `loyaltyStatus` event. We recommend setting the analyzed period to **Lifetime**. 

1. Go to <img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/icons/behavioral-data-hub-icon.svg" alt="Behavioral Data Hub icon" class="icon"> **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.  
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **First**.  
4. Select the event `loyaltyStatus`.
5. As a parameter, choose **Timestamp**.
6. Select **status**.
7. Use the **Equal (String)** operator and as the value, enter `active`.
8. Set the analyzed period to **Lifetime**. 
9. Click **Save**.

<figure>
    <img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/use-cases/all-cases/_gfx/time-of-the-first-loyaltystatus.png" class="full" alt="Configuration of the aggregate">
    <figcaption>Configuration of the aggregate</figcaption>
    </figure>

## Prepare an aggregate that counts the total transaction value
---
In this part of the process, create an aggregate which counts the total value of transactions for a particular customer. It will be counted from the date of joining the loyalty program, but no longer than 365 days backwards from the current date.

1. Go to <img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/icons/behavioral-data-hub-icon.svg" alt="Behavioral Data Hub icon" class="icon"> **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.  
2. Enter the name of the aggregate.
3. Click **Analyze profiles by** and select **Sum**. 
4. Select the **transaction.charge** event.
5. As the event parameter, select `$totalAmount`, then choose **TIMESTAMP**.
6. Use operator **More than (Date)** and as the value add the aggregate which you have created [in the previous step](#prepare-an-aggregate-which-returns-the-time-of-joining-the-loyalty-program).  
7. Set the analyzed period to **Last 365 days**.
7. Save the aggregate.

<figure>
<img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/use-cases/all-cases/_gfx/loyalty-aggregate.png" alt="Configuration of the aggregate" class="full no-frame">   
<figcaption> Configuration of the aggregate</figcaption></figure>

## Prepare an aggregate that counts the value of returns
---
In this stage of the process, create an aggregate that counts the total value of returns made by a customer. It will be counted from the date of joining the loyalty program, but no longer than 365 days backwards from the current date.

1. Go to <img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/icons/behavioral-data-hub-icon.svg" alt="Behavioral Data Hub icon" class="icon"> **Behavioral Data Hub > Live Aggregates > Create aggregate**.
2. As the aggregate type, select **Profile**.  
2. Enter the name of the aggregate.  
3. Click **Analyze profiles by** and select **Sum**.   
4. Select the **product.return** event.  
5. As the event parameter, select `$totalAmount`, then choose **TIMESTAMP**.  
6. Use operator **More than (Date)** and as the value add the aggregate which you have created [in the previous step](#prepare-an-aggregate-which-returns-the-time-of-joining-the-loyalty-program).  
7. Set the analyzed period to **Last 365 days**.  
7. Save the aggregate.  

<figure>
<img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/use-cases/all-cases/_gfx/loyalty-aggregate1.png" alt="Configuration of the aggregate" class="full no-frame">   
<figcaption> Configuration of the aggregate</figcaption></figure>

## Prepare an expression counting the balance
---
In this part of the process, prepare an expression which counts the account balance for a specific customer. The formula of the expression is a mathematical operation which deducts the [value of returns](/use-cases/loyalty-color-schemas#prepare-an-aggregate-that-counts-the-value-of-returns) from the [total value transactions](/use-cases/loyalty-color-schemas#prepare-an-aggregate-that-counts-the-total-transaction-value). 

1. Go to <img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/icons/behavioral-data-hub-icon.svg" alt="Behavioral Data Hub icon" class="icon"> **Behavioral Data Hub > Expressions > New expression**.
2. From the **Expressions for** dropdown list, select **Attribute**.
3. Build the following formula of the expression:  
    <figure>
    <img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/use-cases/all-cases/_gfx/loyalty-expression.png" alt="Formula of the expression" class="full">
    <figcaption> Formula of the expression </figcaption>
    </figure>
5. Save the expression.

## Prepare an expression that returns the tier number
---
Prepare the expression which returns the numerical value (from 1 to 4) which signifies the tier to which a customer belongs to. If the expression returns:
- `1` - the customer belongs to the `White` tier (transactions under 300 PLN)
- `2` - the customer belongs to the `Green ` tier (transactions from 300 PLN to 999,99 PLN)
- `3` - the customer belongs to the `Silver` tier (transactions from 1000 PLN to 1999,99 PLN)
- `4` - the customer belongs to the `Golden` tier (transactions above 2000 PLN)

The expression checks if the customer is part of a loyalty program, and then checks if they meet the conditions to join the highest level of the loyalty program. If not, conditions for the next level are checked, and so on until the lowest level. In the case of an error in the dat or when the customer is not assigned to any group, the expression returns `error`.



<figure>
<img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/use-cases/all-cases/_gfx/loyalty-expression2.png" alt="Formula of the expression" class="full">
<figcaption> Formula of the expression - first part </figcaption>
</figure>

<figure>
<img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/use-cases/all-cases/_gfx/loyalty-expression3.png" alt="Formula of the expression" class="full">
<figcaption> Formula of the expression - second part </figcaption>
</figure>

## Create a segmentation of customers in tiers 
---
As the next step, you can prepare a segmentation of customers who belong to the loyalty program. The segmentation will consist of 4 segments (white, green, silver, golden) and the customers will be assigned to each segment based on the result of the [expression that returns the tier number](#prepare-an-expression-that-returns-the-tier-number) they received.

1. Go to <img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/icons/decision-hub-icon.svg" alt="Decision Hub icon" class="icon" > **Decision Hub > Segmentations > New Segmentation**.
2. Enter the name of the segmentation. 
3. Choose **Add condition**.
4. From the dropdown list, find the [expression that returns the tier number](/use-cases/loyalty-color-schemas#prepare-an-expression-that-returns-the-tier-number) you have created in the previous part of the process.
4. Select the **Equal** operator.
5. In the text field, enter the number that signifies a tier. In our case, enter `4` to include only customers from the `Golden` tier (total balance is equal or greater than 2000 PLN). 
5. Set the name of the segment, for example `Golden`.
6. Hover a mouse cursor over the segment and click the **Duplicate** option. 
6. Repeat steps 3-6 for the remaining 3 tiers. Enter the following values for the next segments: `3` (for the Silver tier segment), `2` (for the Green tier segment), `1` (for the White tier segment).
5. Save the segmentation.

<figure>
<img src="/api/docs/image/54176ad07f146575310749eba44b7c2f42c1b327/use-cases/all-cases/_gfx/loyalty-segmentation.png" alt="Segmentation settings"  class="full">
<figcaption>Segmentation settings</figcaption>
</figure> 


<div class="admonition admonition-note"><div class="admonition-icon"><svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5"><path stroke-linecap="round" stroke-linejoin="round" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" /></svg></div><div class="admonition-body"><div class="admonition-content">

You can later use those segments as an audience in your campaigns and send them personalized messages and promotions. To use the specific segment in the further communication, just create an audience where the result of this segment will be equal to the chosen value (for example `4` for the Golden tier).

</div></div></div>


## What's next
---
This use case describes the basic assumptions of creating 4 tiers of loyalty. You can expand it by adding additional conditions, for example:
- **Avoid abuse** - You can add a condition based on which the customers who have spent a certain amount can advance to a higher level and benefit from discounts only after the maximum return period has expired (for example, 30 days).
- **Set up a billing cycle** - Suggested to be set to 12 months from achieving a particular level. During this time, a customer must make purchases for an amount specified in the terms and conditions to maintain the given level.
- **Set up account validity** - Consider account validity, for example, 3 years from creating an account. During this time, a customer must confirm/update their data and meet other requirements such as making a certain number of transactions to maintain the account status.

## Check the use case set up on the Synerise Demo workspace
---
You can check all the analytics directly in the Synerise Demo workspace:
- aggregate returning [the time of joining the loyalty program](https://app.synerise.com/analytics/aggregates/67c86eda-4f75-35df-ad31-db88c8932b5c) 
- aggregate returning [the total value of transactions](https://app.synerise.com/analytics/aggregates/e5995d34-e567-3783-b8d0-cea447f60e58) for a specific customer
- aggregate returning [the total value of returns](https://app.synerise.com/analytics/aggregates/f57db416-4f61-33ce-a220-d9b47a8e63e8) for a particular customer
- expression returning [the balance](https://app.synerise.com/analytics/expressions/1edff9ca-66c5-415f-b35f-252ce50c96b2) for specific customer
- expression which [returns the numerical value of a tier a customer belongs to](https://app.synerise.com/analytics/expressions/bbe376a4-9a92-434f-bdbb-5c588fcfe44d)
- example [segmentation that divides customers](https://app.synerise.com/analytics-v2/segmentations/ebc292c1-6064-490d-a747-7a62567e81ee) into four tiers in the loyalty program.

If you’re our partner or client, you already have automatic access to the **Synerise Demo workspace (1590)**, where you can explore all the configured elements of this use case and copy them to your workspace.  

If you’re not a partner or client yet, we encourage you to fill out the contact [form](https://demo.synerise.com/request) to schedule a meeting with our representatives. They’ll be happy to show you how our demo works and discuss how you can apply this use case in your business. 


## Read more
---

- [Aggregates](/docs/analytics/aggregates)
- [Expressions](/docs/analytics/expressions)

Check our loyalty use cases:
- [Award loyalty points for reaching a specific number of transactions](/use-cases/mechanism-of-stamps)
- [Promotion for the first transaction after joining the loyalty program](/use-cases/discount-promotion-for-first-transaction)
- [Promotion triggered by basket value](/use-cases/promotion-triggered-by-basket-value)
- [Rewarding customers in loyalty program for custom activities](/use-cases/adding-points-for-custom-event)
- [Send mobile push notifications with birthday promotion](/use-cases/mobile-push-birthday-promotion)
- [Transfer loyalty points between customers](/use-cases/loyalty-points-transfer-with-push)
