26 real-time scoring models, p95 under 3ms per event (CI-enforced). Feature extraction pipeline, 4-phase model architecture, and dual dataset approach.
Traditional analytics platforms collect events and process them in batch, often hours or days after the interaction occurred. ClickStream takes a fundamentally different approach: 26 behavioral scoring models execute at the edge — in the same Cloudflare Worker that processes the incoming event — with a CI-enforced benchmark holding the full scoring pass under 3 milliseconds at p95, and zero origin server round-trips. This whitepaper details the feature extraction pipeline, the behavioral features contract, the 4-phase model architecture (core, psychological, predictive, contextual), the dual dataset approach — a raw events dataset and a dedicated scores dataset, both on Cloudflare Analytics Engine — and the documented blob/double field allocation. Every behavioral signal is computed before the HTTP response is returned to the client.
When you open the Intelligence tab in your ClickStream dashboard at einstein.clickstream.com, you see 26 real-time behavioral scores updating for every active visitor (behavioral scoring models unlock on paid plans, Growth and above). Those scores are computed at the Cloudflare edge closest to each visitor, in milliseconds, as each event is ingested. You don't need to configure or deploy anything; the platform handles it all. This whitepaper explains the architecture that makes it possible.
Behavioral intelligence loses value with latency. A frustration score computed 24 hours after a user rage-quit your checkout flow cannot prevent the abandonment. An intent signal processed in a batch pipeline cannot trigger a real-time personalization. The value of behavioral signals decays exponentially with time.
ClickStream processes all behavioral scoring at the edge for three reasons:
Behavioral intelligence is not a data warehouse query. It is a real-time signal that must be computed, stored, and actionable within the same HTTP request-response cycle that captures the raw event.
Every incoming event passes through a feature extraction pipeline before any scoring model executes. The pipeline transforms raw event data into normalized features:
The SDK sends a structured event payload with every interaction. The example below is a representative payload — illustrative of the shape, not the literal wire format:
Raw values are normalized to 0–1 scales using domain-specific ranges. The examples below are simplified for illustration:
| Raw Feature | Normalization | Range |
|---|---|---|
scrollDepth |
Already 0–1 | [0, 1] |
timeOnPage |
log(ms) / log(600000) | [0, 1] (capped at 10 min) |
clickCount |
min(clicks / 20, 1) | [0, 1] |
mouseVelocity |
min(velocity / 10, 1) | [0, 1] |
rageClicks |
min(rageClicks / 5, 1) | [0, 1] |
sessionPageCount |
min(pages / 15, 1) | [0, 1] |
formInteractions |
min(interactions / 10, 1) | [0, 1] |
All extracted and normalized features are structured into a BehavioralFeatures interface that serves as the input contract for all 26 scoring models. The interface shown here is simplified for illustration — the production contract is richer and evolves with the SDK:
Phase 1 models evaluate the fundamental behavioral signals that apply to every visitor on every page. They execute first because the later phases build on their outputs.
| # | Model | Output | Use Case |
|---|---|---|---|
| 1 | Intent Classification | 0–100 score + stage: browsing, researching, evaluating, or converting | Lead scoring, sales prioritization, real-time chat triggers |
| 2 | Frustration Detection | 0–100 score + list of contributing signals | UX problem detection, bug prioritization, support escalation triggers |
| 3 | Engagement Scoring | 0–100 score + attention seconds (meaningful interaction time) | Content optimization, audience segmentation |
| 4 | Value Prediction | Long-term value score + conversion probability | Prospect prioritization, ad spend allocation |
| 5 | Anomaly Detection | Anomaly score + anomaly type | Traffic-quality monitoring, data integrity protection |
The engagement score uses a weighted combination of normalized features. The snippet below is simplified for illustration — production weights are tunable per site via ClickStream's scoring configuration:
The frustration score is critical for real-time UX monitoring — the Signals helper treats scores of 60 and above as a struggling visitor. Again, simplified for illustration:
Phase 2 models infer higher-order psychological states from the combination of Phase 1 outputs and raw features. These models require more context and produce signals that are useful for personalization and content strategy.
| # | Model | Output | Use Case |
|---|---|---|---|
| 6 | Confusion Detection | Confusion score + type: lost, overwhelmed, searching, or stuck | Navigation fixes, contextual help triggers, IA optimization |
| 7 | Emotional State | One of 8 states (curious, engaged, frustrated, confused, excited, decisive, hesitant, neutral) + confidence | Tone-matched personalization, content strategy |
| 8 | Decision Confidence | Confidence score + decision stage | CTA timing optimization, offer presentation triggers |
| 9 | Regret Detection | Post-conversion regret risk | Churn-prevention follow-up, refund-risk mitigation |
Decision confidence combines intent with behavioral signals that indicate a visitor is moving toward a conversion event. Simplified for illustration — production weights are per-site tunable:
Phase 3 models produce forward-looking predictions about visitor behavior, building on Phase 1 and Phase 2 outputs.
| # | Model | Output | Use Case |
|---|---|---|---|
| 10 | Churn Prediction | Churn risk + confidence + risk factors + retention signals | Retention campaigns, win-back triggers |
| 11 | Purchase Timing | Conversion proximity + urgency + session phase | Sales notification, follow-up cadence |
| 12 | LTV Scoring | LTV score + tier + confidence | Customer segmentation, ad spend allocation |
| 13 | Abandonment Detection | Abandonment probability + stage + intervention recommendation | Cart and checkout rescue, exit-intent calibration |
| 14 | Content Affinity | Affinity strength + content type + pattern | Content recommendation, personalized navigation |
| 15 | Form Friction | Friction score + friction type + signals | Form optimization, field-level UX fixes |
| 16 | Next Action Prediction | Predicted action + confidence + alternatives | Journey orchestration, preemptive personalization |
Phase 4 rounds out the 26-model inventory with contextual and traffic-quality intelligence — session-level quality, campaign and device context, and the behavioral half of bot detection.
| # | Model | What It Captures |
|---|---|---|
| 17 | Scroll-Depth Intelligence | How deeply and meaningfully content is consumed |
| 18 | Session Quality | Overall quality of the session's interactions |
| 19 | Conversion Readiness | How close the session is to a conversion event |
| 20 | Bot Detection Score | Behavioral bot likelihood (see below) |
| 21 | Navigation Pattern | Page-transition patterns across the session |
| 22 | Return Visitor | Returning-visitor behavior and cadence |
| 23 | Campaign Response | How the visitor responds to the acquiring campaign |
| 24 | Device Engagement | Engagement in the context of device type |
| 25 | Time-of-Day Affinity | When this visitor engages best |
| 26 | Loyalty Trajectory | Direction of the visitor relationship over time |
Two additional metrics are computed inline by the scoring orchestrator rather than as standalone models: session momentum (−100 to 100) and navigation entropy (Shannon entropy of page-transition patterns).
The Phase 4 bot-detection model contributes the behavioral half of ClickStream's bot verdict — it protects the integrity of all other scores. In production, bot detection is two-layer: a per-request bot score, built from Cloudflare Bot Management signals, a registry of 158 named bots across 8 categories (including 38 named AI agents), datacenter-ASN checks, and header-inconsistency analysis, is reconciled with the per-session behavioral human-confidence score into a single composite verdict. No single behavioral heuristic decides the outcome.
ClickStream writes behavioral data to two complementary datasets, each optimized for different access patterns:
The Events dataset captures every raw interaction. It is append-only, high-throughput, and optimized for aggregation queries. Each write is a single structured event with up to 20 blob (string) fields and 20 double (numeric) fields.
The Scores dataset (clickstream_scores) is a second, dedicated Analytics Engine dataset that stores every computed behavioral score per event, with a fully documented 20-blob/20-double allocation. Relational state — the dashboard, usage metering, and the identity graph — lives separately in Cloudflare D1.
| Characteristic | Analytics Engine (Events) | Analytics Engine (Scores) |
|---|---|---|
| Data model | Append-only events | Append-only score rows |
| Write pattern | Every event (high volume) | Every scored event |
| Query pattern | Aggregations, time series | Score aggregations, time series |
| Retention | ~90 days (platform retention) | ~90 days (platform retention) |
| Schema | 20 blobs + 20 doubles | 20 blobs + 20 doubles (documented score allocation) |
| Best for | Dashboards, trends, funnels | Behavioral intelligence, score trends |
Each Analytics Engine write carries up to 20 blob (string) fields and 20 double (numeric) fields. The Scores dataset uses a fixed, documented allocation for those fields — the stable interface between the edge worker and the intelligence dashboard. A selection of the documented allocation:
| Field | Content | Range / Format |
|---|---|---|
double2 | Purchase intent score | 0–100 |
double3 | Frustration score | 0–100 |
double7 | Session momentum | −100 to 100 |
double8 | Navigation entropy | Shannon entropy of page transitions |
double9 | Attention | Seconds of meaningful interaction |
double15 | Churn risk | 0–100 |
double17 | LTV score | Numeric score |
double19 | Composite bot flag | Reconciled two-layer bot verdict |
blob7 | Frustration signals | Contributing signal list |
blob14 | LTV tier | e.g. tier_3 |
Every field in the 20-blob/20-double envelope has a fixed assignment in the scoring service, so dashboards and downstream aggregation can rely on a stable schema for all 26 model outputs.
ClickStream enforces its latency claim in CI: a permanent benchmark gate fails the build if the full 26-model scoring pass exceeds 3 ms at the 95th percentile (10,000 iterations across 5 realistic visitor profiles).
| Metric | Value |
|---|---|
| CI benchmark gate | p95 < 3 ms for the full scoring pass (the build fails otherwise) |
| Benchmark workload | 10,000 iterations × 5 realistic visitor profiles |
| Individual model spot checks | 8 models, each held to p95 < 3 ms |
| Production code budget | ~2–3 ms per event |
| Models executed per event | 26 |
| Event batch size | ~2 KB every 5 seconds |
A CI-enforced p95 under 3 ms means the full 26-model pass fits inside the event-ingest request itself — faster than a single database query in most traditional architectures.
Edge-computed behavioral intelligence represents a paradigm shift from batch-processed analytics to real-time signal extraction. By executing 26 scoring models at the edge — with a CI-enforced benchmark holding the full pass under 3ms at p95 — ClickStream transforms raw clickstream events into actionable behavioral signals before the HTTP response is returned to the client.
The 4-phase architecture ensures that models build on each other in a dependency chain — core behavioral measurements feed psychological inferences, which in turn power predictive and contextual models. The dual dataset approach (an events dataset for raw interactions, a dedicated scores dataset for the 26-model outputs — both on Analytics Engine) ensures that behavioral data is optimally stored for both dashboarding and behavioral intelligence, while relational state lives in Cloudflare D1.
The practical implications are significant: frustration detection that triggers support chat in real-time, intent scoring that alerts sales teams to high-value prospects while they are still on the site, churn risk signals that activate retention campaigns before the customer disengages, and bot detection that protects ad spend on every page view.
All of this happens at the edge, in the same infrastructure that sets the first-party cookie and resolves the visitor identity. No batch pipeline. No external ML service. No origin server dependency. Just 26 models, a single synchronous pass, and a CI-enforced 3-millisecond budget.
Identify high-intent visitors — scored in milliseconds at the edge — and trigger conversion opportunities before they leave. Turn behavioral data into revenue.
Start free