Skip to main content

Context Variables

Context Variables

Overview

Derived Context Variables are computed server-side from the normalized context generated by the Cloudflareadctv Worker.backend. 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 Context

Variable 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

TypeParameters

Possible ValuesType

LogicPossible Values

weather.temperature_band

temp

String

hot

,

warm

,

cold

temp >= 35 → hot

,

25 ≤ temp < 35 → warm

, otherwise

cold

weather.condition_type

condition

String

sunny

,

cloudy

,

rainy

,

stormy

,

snowy

,

foggy

Maps weather condition text/code returned by the weather provider

weather.uv_level

uv_index

String

low

,

moderate

,

high

,

extreme

UV < 3 → lowcomfort_level

temp

,

3–6 → moderate

,

6–9 → high

,

>=10 → extreme

weather.comfort_levelhumidity

String

comfortable

,

humid

,

hot_humid

,

cold

Derived from temperature and humidity

weather.wind_level

wind_speed

String

calm

,

moderate

,

windy

,

stormy

<5

,

5–20

,

20–40

,

>40 km/h

weather.is_daylight

is_day

Boolean

true

,

false

weather.is_day == true

weather.precipitation_level

precip

String

none

,

light

,

moderate

,

heavy

Derived from precipitation amount

weather.visibility_level

visibility

String

clear

,

moderate

,

poor

Derived from visibility distance

weather.activity_suitability

temp

,

precip

,

uv_index

,

wind_speed

String

excellent

,

good

,

poor

Combination of temperature, precipitation, UV index and wind


Time Variables

Variable

TypeParameters

Possible ValuesType

LogicPossible Values

time.daypart

hour

String

early_morning

,

morning

,

afternoon

,

evening

,

night

05:00–08:00is_weekend

day_of_week

Boolean

true

,

08:00–12:00false

is_work_hours

hour

,

12:00–17:00

,

17:00–21:00

, otherwise

night

time.is_weekend

Boolean

true

,

false

Saturday or Sunday

time.is_work_hoursis_commuting_hours

hour

Boolean

true

,

false

09:00–18:00

 on weekdays

time.meal_period

hour

String

breakfast

,

lunch

,

snack

,

dinner

,

late_night

Determined from the current hour

time.productivity_state

hour

,

is_work_hours

String

productive

,

relaxed

,

sleeping

Derived from daypart and work hours


Network Variables

Variable

TypeParameters

Possible ValuesType

LogicPossible Values

network.speed_tier

rtt

,

protocol

String

fast

,

moderate

,

slow

Derived from RTT and HTTP protocol

network.connection_stabilitysupports_rich_media

String

stablespeed_tier

,

unstable

RTT heuristics

network.connection_type

String

broadband

,

mobile

,

enterprise

,

unknown

ASN and ISP lookup

network.is_broadbandprotocol

Boolean

true

,

false

Derived from ASN/ISP mapping

network.supports_rich_mediavideo_quality_tier

Boolean

true

,

false

Fast connection and modern protocol (HTTP/3)

network.video_quality_tierspeed_tier

String

low

,

medium

,

high

Recommended video quality based on network capability


Traffic Variables

Variable

TypeParameters

Possible ValuesType

LogicPossible Values

traffic.quality_tier

bot_score

,

is_bot

,

is_corporate_proxy

String

high

,

medium

,

low

Derived from bot score, proxy detection and network quality

traffic.is_suspicious

bot_score

,

is_bot

,

is_corporate_proxy

Boolean

true

,

false

Bot or proxy detection

traffic.trust_score

bot_score

,

is_bot

,

is_corporate_proxy

Number

0–100

Weighted trust scoring algorithm


Audience Variables

Variable

TypeParameters

Possible ValuesType

LogicPossible Values

audience.outdoor_score

temp

,

precip

,

uv_index

,

wind_speed

,

is_daylight

Number

0–100

Weighted weather and daylight score

audience.outdoor_likelihood

outdoor_score

String

high

,

medium

,

low

Derived from outdoor score

audience.commerce_intent

hour

,

is_weekend

,

is_work_hours

,

daypart

,

temp

,

precip

,

condition_type

String

high

,

medium

,

low

Based on time, weather and work state

audience.engagement_likelihood

quality_tier

,

speed_tier

,

daypart

,

is_work_hours

String

high

,

medium

,

low

Derived from traffic quality, network capability and time

audience.mobility_state

hour

,

is_weekend

,

is_work_hours

,

daypart

,

activity_suitability

String

sleeping

,

commuting

,

working

,

stationary

,

leisure

,

sleepingstationary

Time and daypart heuristics

audience.session_mood

daypart

,

is_work_hours

,

is_weekend

,

mobility_state

,

condition_type

String

productive

,

relaxed

,

entertainment

,

rushed

Behavioural context

audience.purchase_context

daypart

,

is_work_hours

,

is_weekend

,

mobility_state

,

condition_type

String

impulse

,

relaxed

,

functional

Combination of time, weather and mobility state


Device Variables


Media

Variable

TypeParameters

Possible ValuesType

LogicPossible Values

device.rich_media_readyvideo_quality

Boolean

truespeed_tier

,

false

Fast network and trusted traffic

device.experience_tier

String

premium

,

standard

,

lite

Combined network and device capability


Media Variables

Variable

Type

Possible Values

Logic

media.video_qualityvideo_quality_tier

String

240p

,

480p

,

720p

,

1080p

Device

Variable

Parameters

Type

Possible Values

Recommendeddevice.type

user_agent

, maximum

viewport.width

String

mobile

, video

tablet

, quality

desktop

, based

tv

device.is_mobile

device.type

Boolean

true

, on

false

device.is_tablet

device.type

Boolean

true

, network

false

device.is_desktop

device.type

Boolean

true

, capability

false

device.is_tv

device.type

Boolean

true

,

false

device.os

user_agent

String

ios

,

android

,

windows

,

macos

,

linux

,

unknown

device.browser

user_agent

String

chrome

,

safari

,

firefox

,

edge

,

opera

,

unknown

device.orientation

viewport.width

,

viewport.height

String

portrait

,

landscape

device.screen_size_tier

screen.width

String

small

,

medium

,

large

,

xl

rich_media_ready

speed_tier

,

trust_score

Boolean

true

,

false


Notes

  • Viewport

    Variable

    Parameters

    Type

    Possible Values

    All derived variables are evaluatedviewport.size_tier

    viewport.width

    String

    xs

    , server-side

    sm

    , in

    md

    , the

    lg

    , Cloudflare

    xl

    viewport.orientation

    viewport.width

    , Worker.

  • Derived

    viewport.height

  • String

    portrait

    , 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.
  • landscape