Context Variables
Context Variables
Overview
Derived Context Variables are computed server-side from the normalized context generated by the Cloudflare Worker. Unlike raw context variables, derived variables represent higher-level contextual insights that creatives can consume directly without implementing business logic in the client runtime.
Benefits
- Zero client-side computation
- Consistent evaluation across all creatives
- Edge-cacheable responses
- Smaller runtime bundle
- Simple variable binding
- Faster creative rendering
Processing Flow
Cloudflare Request
│
▼
Geo + Network + Bot
│
▼
Weather API
│
▼
Normalize Context
│
▼
Evaluate Derived Variables
│
▼
Cache Final Response
│
▼
Return ContextVariable Categories
Category | Description |
|---|---|
Weather | Temperature, comfort, daylight and weather classifications |
Time | Daypart, work hours and behavioural context |
Network | Network capability and media suitability |
Traffic | Traffic quality and trust signals |
Audience | Behavioural context for personalization |
Device | Device capability and rendering suitability |
Media | Recommended media quality |
Weather Variables
Variable | Type | Possible Values | Logic |
|---|---|---|---|
| String |
,
,
|
,
, otherwise
|
| String |
,
,
,
,
,
| Maps weather condition text/code returned by the weather provider |
| String |
,
,
,
|
,
,
,
|
| String |
,
,
,
| Derived from temperature and humidity |
| String |
,
,
,
|
,
,
,
|
| Boolean |
,
|
|
| String |
,
,
,
| Derived from precipitation amount |
| String |
,
,
| Derived from visibility distance |
| String |
,
,
| Combination of temperature, precipitation, UV index and wind |
Time Variables
Variable | Type | Possible Values | Logic |
|---|---|---|---|
| String |
,
,
,
,
|
,
,
,
, otherwise
|
| Boolean |
,
| Saturday or Sunday |
| Boolean |
,
|
on weekdays |
| String |
,
,
,
,
| Determined from the current hour |
| String |
,
,
| Derived from daypart and work hours |
Network Variables
Variable | Type | Possible Values | Logic |
|---|---|---|---|
| String |
,
,
| Derived from RTT and HTTP protocol |
| String |
,
| RTT heuristics |
| String |
,
,
,
| ASN and ISP lookup |
| Boolean |
,
| Derived from ASN/ISP mapping |
| Boolean |
,
| Fast connection and modern protocol (HTTP/3) |
| String |
,
,
| Recommended video quality based on network capability |
Traffic Variables
Variable | Type | Possible Values | Logic |
|---|---|---|---|
| String |
,
,
| Derived from bot score, proxy detection and network quality |
| Boolean |
,
| Bot or proxy detection |
| Number |
| Weighted trust scoring algorithm |
Audience Variables
Variable | Type | Possible Values | Logic |
|---|---|---|---|
| Number |
| Weighted weather and daylight score |
| String |
,
,
| Derived from outdoor score |
| String |
,
,
| Based on time, weather and work state |
| String |
,
,
| Derived from traffic quality, network capability and time |
| String |
,
,
,
,
| Time and daypart heuristics |
| String |
,
,
,
| Behavioural context |
| String |
,
,
| Combination of time, weather and mobility state |
Device Variables
Variable | Type | Possible Values | Logic |
|---|---|---|---|
| Boolean |
,
| Fast network and trusted traffic |
| String |
,
,
| Combined network and device capability |
Media Variables
Variable | Type | Possible Values | Logic |
|---|---|---|---|
| String |
,
,
,
| Recommended maximum video quality based on network capability |
Notes
- All derived variables are evaluated server-side in the Cloudflare Worker.
- Derived variables are returned alongside raw context variables in the API response.
- Creatives consume derived variables exactly like normal context variables.
- No client-side expression evaluation is required.
- The final response, including derived variables, can be cached at the Cloudflare edge for optimal performance.