# Increase customer engagement with an Advent calendar campaign

> Many brands use Advent calendar campaigns to drive engagement and boost sales during the festive season. Using a recurring fixed-schedule achievement, brands can track customer progress towards a target that resets after a pre-defined period of time. For example, customers can receive a reward for making at least one purchase every week in the four weeks leading up to Christmas.

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

In this tutorial, we will create an Advent calendar campaign that rewards
customers for making multiple purchases during the Advent period:
- **Goal**: Encourage customers to make at least one purchase every week during
  the 4-week Advent period.
- **Duration**: The promotion runs for a limited time period:
  - **Start**: December 1, 2025, 00:00:00
  - **End**: December 24, 2025, 23:59:59
- **Reward**:
  - Each weekly purchase earns the customer a $2 coupon.
  - If the customer makes four purchases, one in each week of the Advent period,
    they receive an additional $7 coupon at the end of the campaign, totaling
    $15 in rewards.

## Set up the achievements and rules

<StepsContainer>

### Prepare your environment

Create a
[standard campaign](/docs/product/campaigns/overview#standard-campaigns)
named `Advent Calendar` with the **Achievements** and **Coupons** features
enabled. We will define the rules for this campaign later in this tutorial.

To set up the campaign, we will first create two achievements, then define rules
to track customer progress during the campaign and award coupons.

### Create an achievement to track weekly purchases

Create a
[recurring on expiration, fixed-schedule achievement](/docs/product/achievements/create-achievements.md)
named `Track weekly purchases` to record the customer's progress with each
weekly purchase:

- Set the **Target** to `1`. This value indicates whether the customer made a
  purchase during a given week of the Advent period.
- Select **End progress on achieving target**.
- Set the **Achievement start** to `2025-12-01 00:00:00`.
- Select **Reset every**: `1` `week`.
- Set the **Achievement end** to `2025-12-24 23:59:59`.

When the customer makes a purchase during a week of the Advent period:
- The customer's progress increases by `1`, which completes the achievement for
  that week.
- The customer receives a coupon for a $2 discount. We will set up the coupon
  reward for every weekly purchase in the campaign rules.

Next, let's set up a one-time, user action achievement to count the weekly
purchases.

### Create an achievement to count weekly purchases

Create a
[one-time user-action achievement](/docs/product/achievements/create-achievements.md)
named `Count weekly purchases` to count the number of weeks the customer made at
least one purchase:

- Set the **Target** to `4`. The customer must complete four weekly purchases in
  the 4-week Advent calendar period.
- Select **End progress on achieving target**.
- Select **Achievement period**: `1` `month`.

Every week, when the customer completes the `Track weekly purchases`
achievement, their progress increases by `1` in the `Count weekly purchases`
achievement.

When the customer completes this achievement, they receive a $7 coupon. We will
set up the coupon reward in the campaign rules.

Now let's set up a rule to increase a customer's progress when they make a
weekly purchase.

### Create a rule to update customer progress

Let's create a rule to add progress if the customer makes at least one purchase
in a given week of the Advent period. We can name the rule
`Increase progress for weekly purchase`.

This rule checks two conditions:
- The `Track weekly purchases` achievement is not completed yet.
- The Rule Engine has triggered a `Customer Session Closing` event, confirming
  that the customer completed a purchase order and the
  [session](/docs/dev/concepts/entities/customer-sessions.md#customer-session-states)
  is in `closed` state.

If both conditions are true, the Rule Engine updates the customer progress in
the `Track weekly purchases` achievement by `1`.

#### Rule 1: Conditions

When **all** of these are true:
- **Check customer progress in an achievement**:
  - **Achievement** `Track weekly purchases` `is not` `Completed`

- **Check for event types and custom event values**:
  - **Event type**: `Customer session Closing`

#### Rule 1: Effects

- **Update customer progress**:
  - **Achievement name**: `Track weekly purchases`
  - **Update progress by**: `1`

### Create a rule to award a coupon for weekly purchase

Let's create a second rule that checks if the `Track weekly purchases`
achievement has been completed for a given week and immediately performs the
following tasks:
- Award the customer with a $2 coupon. The coupon's validity is set to three
  months after the session, on the last day of the month.
- Increase customer progress in the `Count weekly purchases` achievement by `1`.

We can name the rule `Award weekly purchase coupon`.

#### Rule 2: Conditions

- **Has completed an achievement**:
  - **Achievement name**: `Track weekly purchases`

#### Rule 2: Effects

- **Create coupon code**:
  - **Campaign**: `In the current campaign`
  - **Recipient**: `Current Customer`
  - **Redemption limit**: `1`
  - **Discount limit**: `2`

  - **Code pattern**:
    - **Use custom code pattern**:
      - **Code length**: `4`
      - **Character set**: `Numbers and letters`
      - **Prefix**: `ADVENT-2025-`

  - **Set start and end time**:
    - **Start date**:
      1. Click <Catalog className="icon"/> to **Select a date variable**.
      1. In **Attribute Selector**, select the <Attribute name="Current time"
         type="builtin"/> attribute.
    - **Expiration date**:
      1. Click <Relative className="icon"/> to **Select a relative date**.
      1. Enter and select `3`
         `month(s) after the session, on the last day of the month`.

- **Update customer progress**:
  - **Achievement name**: `Count weekly purchases`
  - **Update progress by**: `1`

### Create a rule for the final reward

Lastly, let's create a rule that checks if the `Count weekly purchases`
achievement has been completed and immediately awards the customer with a $7
coupon. The coupon's validity is set to three months after the session, on the
last day of the month.

#### Rule 3: Conditions

- **Has completed an achievement**:
  - **Achievement name**: `Count weekly purchases`

#### Rule 3: Effects

- **Create coupon code**:
  - **Campaign**: `In the current campaign`
  - **Recipient**: `Current Customer`
  - **Redemption limit**: `1`
  - **Discount limit**: `7`

  - **Code pattern**:
    - **Use custom code pattern**:
      - **Code length**: `4`
      - **Character set**: `Numbers and letters`
      - **Prefix**: `XMAS-2025-`

  - **Set start and end time**:
    - **Start date**:
      1. Click <Catalog className="icon"/> to **Select a date variable**.
      1. In **Attribute Selector**, select the <Attribute name="Current time"
         type="builtin"/> attribute.
    - **Expiration date**:
      1. Click <Relative className="icon"/> to **Select a relative date**.
      1. Enter and select `3`
         `month(s) after the session, on the last day of the month`.
</StepsContainer>

## Related pages

- [Achievements](/docs/product/achievements/overview.md)
- [Create achievements](/docs/product/achievements/create-achievements.md)
