# Basic referral

> We can use referrals for our customers' friends to become customers too.

> For the complete documentation index, see [llms.txt](https://docs.talon.one/llms.txt).

Let's [create a standard campaign](/docs/product/campaigns/create-and-manage-campaigns.md#create-a-campaign-from-scratch) to:

- Give customers a referral code and a 20% discount if their cart items total is 50 or more.
- Give a 30% discount on the total value of their first purchase if they redeem a valid referral
  code in the first two weeks after the code was created. If they redeem a valid referral code
  after those first two weeks, they will get a 10% discount.

This campaign can be useful to increase our customer base and convert our advocates' friends
to active customers by encouraging use of the referral codes.

Let's create:

1. A [promotion rule](/docs/product/rules/overview.md#promotion-rules) to issue a 20% [discount on
   the session total](/docs/product/rules/effects/use-effects#discount-session-total)
   and [create a referral code](/docs/product/rules/effects/use-effects.md#create-a-referral-code).
1. A promotion rule to issue a 30% discount on the session total during the first 14 days
   from the creation of the code.
1. A promotion rule to issue a 10% discount on the session total after the first 14 days from
   the creation of the code.

:::note
The [**Referrals** feature](/docs/product/campaigns/settings/manage-campaign-features.md)
has to be enabled.
:::

## Issue a 20% discount and creating a referral code

Let's [build a rule](/docs/product/rules/create-and-manage-rules.md#create-a-promotion-rule)
for the customers to receive a referral code and a 20% discount on the total value of their
purchase when they have items worth at least 50 in their cart.

Let's name the rule `20% discount advocate`. It has two conditions and two effects.

### Rule 1: Conditions

- **Check attribute value**: **Cart items total (Current session) is greater than or equal to** `50`.
- **Check attribute value**: **First session ever? (Current session)** is `False`.

### Rule 1: Effects

- **Discount session total**: **Name** is `20% off` and **Discount value** is `[Session.Total]*20%`.
- **Create referral code**: **In the current campaign** and **Redemption limit** is `1`.

## Issue a 30% discount during the 14 first days

Let's build a rule for the customers to receive a 30% discount on the total value of their
first purchase when they redeem a valid referral code during the first 14 days from the creation
of the code.

Let's name the rule `30% discount for 14 days`. It has three conditions and one effect.

### Rule 2: Conditions

- **Referral code is valid**.
- **Check attribute value**: **First session ever? (Current session)** is `True`.
- **Check attribute value**: **Create Date (Referral) is after** `14`
  **days prior to the session**.

  :::note
  This means that the creation date of the referral code is within 14 days before the
  current session closes.
  :::

### Rule 2: Effect

**Discount session total**: **Name** is `30% off` and **Discount value** is `[Session.Total]*30%`.

## Issue a 10% discount after the 14 first days

Let's build a rule for the customers to receive a 10% discount on the total value of their
first purchase when they redeem a valid referral code after the first 14 days from the creation
of the code.

Let's name the rule `10% discount after 14 days`. It has three conditions and one effect.

### Rule 3: Conditions

- **Referral code is valid**.
- **Check attribute value**: **First session ever? (Current session)** is `True`.
- **Check attribute value**: **Create Date (Referral) is before** `14`
  **days prior to the session**.
  

  :::note
  This means that the creation date of the referral code is not within 14 days before the
  current session closes.
  :::

### Rule 3: Effect

**Discount session total**: **Name** is `10% off` and **Discount value** is `[Session.Total]*10%`.

## Related pages

- [Incentivize share of product links](/docs/product/tutorials/referrals/incentivize-product-link-share.md)
- [Referrals overview](/docs/product/campaigns/referrals/referral-overview.md)
- [Reward advocates with loyalty points](/docs/product/tutorials/loyalty/loyalty-points-for-referral.md)
