--- title: "Add Attribute Automations" slug: "add-attribute-automations" updated: 2026-09-24T12:54:27Z published: 2026-09-24T12:54:27Z canonical: "docs.xtremepush.com/add-attribute-automations" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.xtremepush.com/llms.txt > Use this file to discover all available pages before exploring further. # Add Attribute Automations Attribute automations allow you to update the value of any number type attribute in one of two ways: - **Event-based**: Updates the attribute value when a specific event occurs. - **Schedule-based**: Updates the attribute value on a recurring cron schedule. In both cases, you specify the trigger type, along with the event or schedule that triggers the automation, and the `math.js` expression that specifies the attribute change. To create an attribute automation, select any numeric attribute under **Users**> **Attributes** and then select **Add Automation**. These attribute value changes are reflected for all users and can be viewed in the **All Users** tab in the Loyalty Hub or under **Data**> **User Profiles**. Some example use cases include: - Reset your user's *weekly_bets* attribute to `0` every week: - Using an event-based automation: - Select a scheduled event. - Set the **Expression**, the `math.js` formula used to calculate the new attribute value, to `0`. This resets the attribute back to zero every time the event fires. - Using a scheduled automation (recommended): - Set the **Cron Expression** to `0 0 * * 1`. - Set the **Expression**, the `math.js` formula used to calculate the new attribute value, to `0`. This resets the attribute back to zero every Monday at midnight. - Increment a user's *total_bets* attribute by 1 each time they place a bet: - Using an event-based automation: - Select the bet placed event. - Set the **Expression** to `aggregatedValue + 1`. This adds 1 to the attribute value every time the event fires. - Accumulate the total amount a user has deposited in a *total_deposits* attribute: - Using an event-based automation: - Select the deposit event. - Set the **Expression** to `aggregatedValue + event.body.amount`. This adds the amount from the event to the attribute value every time the event fires. ## Configure Attribute Automation To configure an automation for an attribute, do the following: 1. Select the attribute under **Loyalty Hub** > **Users** > **Attributes** 2. Click **Add Automation** 3. Under **Trigger Type**, choose how the automation runs: - **Event-based**: Triggers when a specific event occurs. - **Schedule-based**: Triggers on a cron schedule. 4. Depending on the trigger type selected: - **Event-based**: Under **Choose Target**, specify the event that triggers the automation. You can also select **Add Requirement** to add conditions on the event's properties, so the automation only runs for events that meet those conditions. - **Schedule-based**: Under **Schedule**, enter a **Cron Expression**, and optionally select **Add Requirement** to filter by user attributes, limiting the automation to users matching specific conditions. > [!NOTE] > Cron expression format > > Only exact-hour cron expressions are supported. The minute field must be a fixed value of `0` and cannot use wildcards, ranges, steps, or lists. > > For example, `0 * * * *` runs every hour on the hour, and `0 4 * * *` runs daily at 4am. Expressions such as `*/5 * * * *`, `0-5 * * * *`, or `0,30 * * * *` are rejected. > [!WARNING] > Scheduled automations run on creation > > A schedule-based automation runs once immediately after you create it, and then runs according to its cron schedule. 5. Under **Create Modifier Expression**, add your `math.js` expression 6. (Optional) under **Advanced Configurations** choose the internal title and description of this automation. > [!TIP] > Tip > > If you're adding an automation rule for the attributes imported from the Xtremepush CDP, the attribute value changes also reflect under **Data** > **User Profiles** for each user.