Skip to content

Commit e4cce5d

Browse files
authored
Merge pull request #7903 from segmentio/maleman842-patch-1
Add window guidance to computed traits docs
2 parents 1942118 + fdd3fdd commit e4cce5d

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

src/api/public-api/query-language.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,14 @@ The following tables list the query languages's available functions.
127127
| Description | You can add a prefix to direct the evaluation to be relative to the timestamp of a different event. |
128128
| Example | `between(7 days, 10 days)` |
129129

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

131139
### Reducers
132140

src/unify/Traits/computed-traits.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Segment currently supports the following types of computed traits:
2727
- [Predictions](/docs/unify/traits/predictions/)
2828
- [Recommended Items](/docs/unify/traits/recommended-items/)
2929
- [Conditions](#conditions)
30+
- [Understanding Windows in Computed Traits](#understanding-windows-in-computed-traits)
3031
- [Connecting your Computed Trait to a Destination](#connecting-your-computed-trait-to-a-destination)
3132
- [Editing Realtime Traits](#editing-realtime-traits)
3233
- [Accessing your Computed Traits using the Profiles API](#accessing-your-computed-traits-using-the-profiles-api)
@@ -157,6 +158,15 @@ The following operators are available:
157158
- equals one of
158159
- contains one of
159160

161+
## Understanding Windows in Computed Traits
162+
163+
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.
164+
- **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.
165+
- **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.
166+
167+
> info "Real-time support for windows"
168+
> 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.
169+
160170
## Connecting your computed trait to a destination
161171

162172
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.

src/unify/product-limits.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ Visit Segment's [pricing page](https://segment.com/pricing/){:target="_blank"} t
5050
| Engage Data Ingest | 1x the data ingested into Connections | The amount of data transferred into the Compute Engine. |
5151
| 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. |
5252
| 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. |
53+
| Session Window Minimum Size | 30 minutes | The minimum size for a session window used with a Computed Traits. |
54+
| Session Window Maximum Size | 90 days | The maximum size for a session window used with a Computed Traits. |
5355

5456

5557
## SQL Traits

0 commit comments

Comments
 (0)