Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/api/public-api/query-language.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ The following tables list the query languages's available functions.
| Description | You can add a prefix to direct the evaluation to be relative to the timestamp of a different event. |
| Example | `between(7 days, 10 days)` |

| `expires_after` | |
| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Syntax | `expires_after({d: Integer} {u: TimeUnit})`<br>`d` - duration value<br>u - second (s) hour (s) day (s)<br> |
| Return Type | `WindowedFilter` |
| Description | You can add a prefix to direct the evaluation to be relative to the timestamp of a different event. |
| Notes | `expires_after` is meant to be used with Computed Traits in order to handle session windows. |
| Example | `expires_after(1 hour)` |


### Reducers

Expand Down
10 changes: 10 additions & 0 deletions src/unify/Traits/computed-traits.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Segment currently supports the following types of computed traits:
- [Predictions](/docs/unify/traits/predictions/)
- [Recommended Items](/docs/unify/traits/recommended-items/)
- [Conditions](#conditions)
- [Understanding Windows in Computed Traits](#understanding-windows-in-computed-traits)
- [Connecting your Computed Trait to a Destination](#connecting-your-computed-trait-to-a-destination)
- [Editing Realtime Traits](#editing-realtime-traits)
- [Accessing your Computed Traits using the Profiles API](#accessing-your-computed-traits-using-the-profiles-api)
Expand Down Expand Up @@ -162,6 +163,15 @@ The following operators are available:
- equals one of
- contains one of

## Understanding Windows in Computed Traits

Computed Traits support windows, giving you control over how user activity is evaluated over time. You can choose between sliding windows and session windows, depending on how you want to define recency or engagement.
- **Sliding Window:** Use this when you want to track actions over a rolling time frame, such as “Orders Completed in the Last 30 Days” or “Emails Opened in the Past Week.” This is ideal for measuring ongoing engagement or recent behavior trends.
- **Session Window:** Use this to capture activity during a user’s most recent session, for example, “Count of Page Viewed events in Current Session” or “Total Purchase Amount in Current Session.” Session windows are especially useful for measuring bursts of engagement and driving personalization based on the user's current session on your site or app. Since session windows reset automatically after the defined inactivity period, the computed trait always reflects behavior from the most recent or current session.

> info "Real-time support for windows"
> Computed traits that use session windows are always created as real-time computations. Those that use sliding windows are created as batch-based computations and do not receive real-time updates.

## Connecting your computed trait to a destination

Segment sends user-level computed Traits to destinations using the [Identify call](/docs/connections/spec/identify/) for user traits, or using the [Track call](/docs/connections/spec/track/) for event properties. Segment includes the trait value and property in the Identify and Track calls.
Expand Down
2 changes: 2 additions & 0 deletions src/unify/product-limits.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ Visit Segment's [pricing page](https://segment.com/pricing/){:target="_blank"} t
| Engage Data Ingest | 1x the data ingested into Connections | The amount of data transferred into the Compute Engine. |
| Audience Frequency Update | 1 per 8 hours | Audiences that require time windows (batch audiences), [funnels](/docs/engage/audiences/#funnel-audiences), [dynamic properties](/docs/engage/audiences/#dynamic-property-references), or [account-level membership](/docs/engage/audiences/#account-level-audiences) are processed on chronological schedules. The default schedule is once every eight hours; however, this can be delayed if the "Batch Compute Concurrency Limit" is reached. Unless otherwise agreed upon, the audiences will compute at the limit set forth. |
| Event Properties (Computed Traits) | 10,000 | For Computed Traits that exceed this limit, Segment will not persist any new Event Properties and will drop new trait keys and corresponding values. |
| Session Window Minimum Size | 30 minutes | The minimum size for a session window used with a Computed Traits. |
| Session Window Maximum Size | 90 days | The maximum size for a session window used with a Computed Traits. |


## SQL Traits
Expand Down