> ## Documentation Index
> Fetch the complete documentation index at: https://moengage.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Computed Traits for Retail

> A reference of computed traits for omnichannel retail: the computation method, data source, and business use case for each trait.

Retail spans physical stores, apps, web, and marketplaces. Computed traits unify signals from all of them into live user attributes you can segment on, personalize with, and branch Flows on, without engineering support or CSV uploads.

This page is a menu. Each row tells you what to build, which computation method to pick, what event data it needs, the business outcome, and how to use it.

New to computed traits? [Computed Traits - Overview](/docs/user-guide/data/computed-traits/computed-traits-overview) explains what they are and how each computation method works, and [Create a Computed Trait](/docs/user-guide/data/computed-traits/create-a-computed-trait) walks through building one.

## How Computed Traits Work

Every trait on this page follows the same four-step model. Once you recognize it, the tables below read at a glance.

<Steps>
  <Step title="Start with an event" icon="database">
    A user behavior you already track, such as Store Visit or Order Placed.
  </Step>

  <Step title="Choose a method" icon="calculator">
    [Count, Aggregation, First/Last Value, or SQL](/docs/user-guide/data/computed-traits/computed-traits-overview#methods-of-computations).
  </Step>

  <Step title="Get a trait" icon="user-check">
    A live attribute like Last Store Visited that updates automatically.
  </Step>

  <Step title="Activate it" icon="rocket">
    Use it in segmentation, analytics, Jinja personalization, and Flows.
  </Step>
</Steps>

Once a trait runs, it becomes a standard user attribute you can use anywhere in MoEngage: build [segments](/docs/user-guide/segment/segment-operations/rule-based-filter-segments) from it, group and filter it in [analytics](/docs/user-guide/analyze/moengage-analytics/overview), insert its value into message copy with [Jinja personalization](/docs/user-guide/campaigns-and-channels/getting-started/message-personalization/jinja-templating-language), or branch a [Flow](/docs/user-guide/flows-cross-channel-messaging/getting-started/overview-flows/overview-flows) on it.

<Tip>
  **Most traits here are no-code.** The <Badge color="green">Count</Badge> <Badge color="green">Aggregation</Badge> and <Badge color="green">First/Last Value</Badge> methods need no SQL. Reach for <Badge color="purple">SQL</Badge> only for composite scores that combine multiple events, or for ratios such as redemption or completion rate. You can build every no-code trait on this page yourself.
</Tip>

## Start Here

Build these three first. They give you the fastest return and the most reuse across campaigns.

<CardGroup cols={3}>
  <Card title="Last Store Visited" icon="store">
    **Last Value** · Unlocks store-based marketing right away.
  </Card>

  <Card title="Total Annual Spend" icon="coins">
    **Aggregation** · Powers loyalty-tier assignment, no SQL needed.
  </Card>

  <Card title="Favorite Department" icon="shapes">
    **Last Value** · Makes every category newsletter dynamic.
  </Card>
</CardGroup>

## Browse Traits by Goal

<Info>
  The event and property names in these tables are examples. The exact names in your account depend on how your app tracks data, so you might not find an event named `Store Visit` as written here. Check your tracked events and properties under **Data** before you build a trait, and ask your development team to track any that are missing. For how tracking works, see [A Complete Guide to Event Tracking](/docs/user-guide/data/event-data/a-complete-guide-to-event-tracking).
</Info>

### Store & Channel

Give every message the right context, whether the shopper is online, in-store, or near a branch.

| Computed Trait                  | Method          | Data Source (Events / Properties)                                           | Business Use Case                                                     | How to Use It                                                                                |
| ------------------------------- | --------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| Last Store Visited              | Last Value      | **Event:** `Store Visit` (from beacon or receipt); **Property:** `store_id` | Personalize in-store offers, inventory alerts, and event invitations. | Send an SMS or push with a store-specific offer, and add a store-manager greeting to emails. |
| Total Store Visits Last 30 Days | Count           | **Event:** `Store Visit`                                                    | Reward frequent visitors and win back lapsed store shoppers.          | Send a loyalty burst at 3 or more visits, and a win-back push at zero visits in 30 days.     |
| Total Online Orders             | Count           | **Event:** `Online Order Placed`                                            | A simple measure of online engagement.                                | Combine with store purchases to segment online-only vs. store-only shoppers.                 |
| Total Store Purchases           | Count           | **Event:** `Store Purchase Completed`                                       | The in-store complement to online orders.                             | Combine with online orders to derive each shopper's channel behavior.                        |
| Online vs. Offline Ratio        | SQL Computation | `Online Orders` / (`Online Orders` + `Store Purchases`)                     | Ratio that captures true omnichannel behavior.                        | Push the app to store-only shoppers, and encourage online-only shoppers to try the store.    |
| Preferred Shopping Time         | Last Value      | **Event:** `Order Placed`; **Property:** `hour_of_day`                      | Time messages and staffing to each shopper's rhythm.                  | Use it as a send-time fallback, and alert store managers before peak-hour campaigns.         |

### Category & Basket

Give merchandisers shopper-level affinity and basket data, without a monthly CSV refresh.

| Computed Trait                | Method                       | Data Source (Events / Properties)                                                                | Business Use Case                                                | How to Use It                                                                                    |
| ----------------------------- | ---------------------------- | ------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| Favorite Department           | Last Value                   | **Event:** `Product Purchased`; **Property:** `department` (Grocery, Apparel, Electronics, Home) | Personalize department newsletters and category promotions.      | Swap content blocks by department, and filter category-launch emails to each shopper's affinity. |
| Average Basket Size (Items)   | Aggregation (Average)        | **Event:** `Order Placed`; **Property:** `item_count`                                            | Tell bulk buyers apart from top-up shoppers.                     | Send bulk buyers multi-buy discounts, and top-up shoppers convenience messaging.                 |
| Average Basket Value          | Aggregation (Average)        | **Event:** `Order Placed`; **Property:** `basket_value`                                          | Personalize free-shipping and gift-with-purchase thresholds.     | Use Jinja to show a dynamic "add a little more for free delivery" message tuned per shopper.     |
| Distinct Categories Purchased | Aggregation (Count Distinct) | **Event:** `Product Purchased`; **Property:** `category`                                         | Reveal how broadly a shopper buys.                               | Send loyalists a deep newsletter, and explorers horizontal recommendation carousels.             |
| Last Category Purchased       | Last Value                   | **Event:** `Product Purchased`; **Property:** `category`                                         | Time cross-sell into adjacent categories right after a purchase. | Run a cross-sell campaign 3 days after purchase, filtered to adjacent-category rules.            |

### Loyalty & Rewards

Turn your loyalty program from spreadsheet admin into always-on marketing with live points and tier attributes.

| Computed Trait                 | Method            | Data Source (Events / Properties)                                       | Business Use Case                                                    | How to Use It                                                                              |
| ------------------------------ | ----------------- | ----------------------------------------------------------------------- | -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| Lifetime Loyalty Points Earned | Aggregation (Sum) | **Event:** `Points Earned`; **Property:** `points`                      | Milestone celebrations that reinforce loyalty and drive redemption.  | Send a milestone push at 1K, 5K, and 10K points, and celebrate the enrollment anniversary. |
| Total Annual Spend             | Aggregation (Sum) | **Event:** `Order Placed` (last 365 days); **Property:** `order_amount` | The driver for loyalty-tier classification.                          | Segment on spend ranges to assign tiers such as Silver, Gold, and Platinum.                |
| Points Balance                 | Aggregation (Sum) | **Event:** `Points Balance Snapshot`; **Property:** `current_balance`   | Reduce point-expiry churn and drive redemption.                      | Use Jinja to show "your `{{points_balance}}` points expire soon."                          |
| Total Redemptions              | Count             | **Event:** `Points Redeemed`                                            | Tell accumulators apart from redeemers.                              | Send accumulators a redemption tutorial, and redeemers bonus-points promos.                |
| Days to Tier Upgrade           | SQL Computation   | Points needed for the next tier, divided by average daily points pace   | Composite motivator showing how close a shopper is to the next tier. | Send a personalized "you're 45 days from Gold" push with a progress bar.                   |

### Coupons & Price

Retail margin is thin. These traits let you personalize discounting instead of blanket-discounting.

| Computed Trait         | Method                | Data Source (Events / Properties)                                                           | Business Use Case                             | How to Use It                                                                          |
| ---------------------- | --------------------- | ------------------------------------------------------------------------------------------- | --------------------------------------------- | -------------------------------------------------------------------------------------- |
| Total Coupons Applied  | Count                 | **Event:** `Coupon Applied`                                                                 | A simple redemption-volume indicator.         | Skip deep discounts for shoppers at zero redemptions in the last 90 days.              |
| Preferred Coupon Type  | Last Value            | **Event:** `Coupon Applied`; **Property:** `coupon_type` (% off, flat, BOGO, free shipping) | Personalize the offer format.                 | Send each shopper only the offer type they have redeemed before.                       |
| Average Discount %     | Aggregation (Average) | **Event:** `Order Placed`; **Property:** `discount_percent`                                 | Each shopper's baseline discount expectation. | Exclude low-average-discount shoppers from mass sale campaigns.                        |
| Coupon Redemption Rate | SQL Computation       | `Coupons Applied` / `Coupons Sent`                                                          | Ratio that concentrates offers on responders. | Put shoppers below 5% on a full-price track, and send deeper offers to high redeemers. |

### Seasonality & Cadence

Retail is seasonal. These traits reveal each shopper's personal seasonality, not just the calendar.

| Computed Trait                        | Method          | Data Source (Events / Properties)                                                     | Business Use Case                                                      | How to Use It                                                                                |
| ------------------------------------- | --------------- | ------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| Last Purchase Date                    | Last Value      | **Event:** `Order Placed`; **Property:** `timestamp`                                  | A universal recency trait for lapse detection.                         | Build segments with date operators for an escalating win-back at 60, 90, and 120 days.       |
| Total Orders (Last 30 / 60 / 90 Days) | Count           | **Event:** `Order Placed` (windowed)                                                  | Frequency signal; combine windows to spot deceleration.                | Compare the 30-day and 90-day trend for early lapse detection.                               |
| Purchase Cadence (Days)               | SQL Computation | Average interval between `Order Placed` events                                        | Composite that times replenishment nudges to each shopper's rhythm.    | Run a Flow that sends a replenishment reminder at 90% of each shopper's cadence.             |
| Seasonal Shopper Flag                 | SQL Computation | High purchase concentration in specific months, such as Diwali, Ramadan, or Christmas | Composite that focuses effort on the moments each shopper cares about. | Send festive campaigns only to festive shoppers, and skip the rest to preserve reachability. |

## Related Documentation

Computed traits are used across MoEngage. These guides cover the surfaces referenced in the tables above:

* [Segments](/docs/user-guide/segment/segment-operations/rule-based-filter-segments): build audiences from a computed trait's value.
* [Analytics](/docs/user-guide/analyze/moengage-analytics/overview): group and filter user behavior by a computed trait's value.
* [Campaigns and channels](/docs/user-guide/campaigns-and-channels/getting-started/introduction/moengage-channels): the channels you can reach users on.
* [Flows](/docs/user-guide/flows-cross-channel-messaging/getting-started/overview-flows/overview-flows): branch users down different paths based on a trait.
* [Message personalization](/docs/user-guide/campaigns-and-channels/getting-started/message-personalization/overview): insert trait values into your content with Jinja.
* [Data](/docs/user-guide/data/key-concepts/overview-data): how MoEngage collects and manages the event data these traits build on.
