Engineering • Behavioral Model Series
Series Introduction

Behavioral Model Deep-Dives: Edge-Computed User Intelligence

How ClickStream transforms raw browser events into 26 real-time behavioral scores -- all computed at the edge, with zero server round-trips and complete data sovereignty.

March 2026

Introduction Part 1: Intent, Frustration & Engagement Part 2: Value & Anomaly Part 3: Confusion & Emotion Part 4: Decision & Regret Part 5: Churn & LTV Part 6: Abandonment & Timing Part 7: Affinity, Friction & Next Action Part 8: Momentum, Entropy & Attention Part 9: Conversion, Hover & Scroll Part 10: Price, Loyalty, Micro-Conversion & Bot Detection

What You'll See in the Dashboard

In the Intelligence tab at einstein.clickstream.com, every active visitor has 26 real-time behavioral scores. Each score is a 0–100 value with color coding: green, amber, red. Click any score card to see its trend chart, contributing signals, and configured alert thresholds. This series explains what each score measures, what it means for your business, and how it works under the hood.

Why Behavioral Scoring at the Edge?

Traditional analytics tools collect events and ship them to a server for batch processing. By the time insights emerge, the user is long gone. ClickStream takes a fundamentally different approach: every behavioral model runs inside a Cloudflare Worker, scoring user behavior in real time at the nearest edge node -- typically within 50ms of the triggering event.

This architecture yields three critical advantages:

The 26 Behavioral Models

ClickStream computes 26 distinct behavioral scores for every active session. Each score is a normalized 0–100 value, updated incrementally as new events arrive. Together, they form a comprehensive behavioral signature that powers personalization, alerting, and predictive analytics.

#ModelWhat It MeasuresSeries Part
1Intent ScorePurchase/conversion likelihood based on navigation patternsPart 1
2Frustration ScoreUser friction signals (rage clicks, dead clicks, error encounters)Part 1
3Engagement ScoreDepth and quality of interaction with contentPart 1
4Value EstimatorPredicted monetary value of the session/visitorPart 2
5Anomaly ScoreStatistical deviation from normal behavioral patternsPart 2
6Confusion ScoreNavigation confusion and information-finding difficultyPart 3
7Emotional StateInferred emotional valence from interaction dynamicsPart 3
8Decision ConfidenceHow confident the user appears in their purchase decisionPart 4
9Regret RiskLikelihood of post-purchase regret or returnPart 4
10Churn PredictionProbability of visitor/customer churnPart 5
11LTV ScorePredicted lifetime value based on behavioral signalsPart 5
12Abandonment ScoreReal-time cart/form/page abandonment detectionPart 6
13Purchase TimingProximity to purchase decision and urgency signalsPart 6
14Content AffinityTopic and content-type preferencesPart 7
15Form FrictionField-level form interaction difficultyPart 7
16Next Action PredictionMost likely next user action with confidence scorePart 7
17Session MomentumVelocity and direction of user progression through sitePart 8
18Click EntropyRandomness/predictability of click patternsPart 8
19Attention ScoreTab visibility, scroll engagement, and active focus signalsPart 8
20Conversion ProbabilityReal-time likelihood of completing a conversion goalPart 9
21Hover IntentHover behavior patterns revealing CTA/product interestPart 9
22Scroll Depth IntelligenceScroll regression, content zone engagement, reading patternsPart 9
23Price SensitivityComparison shopping behavior, price page revisits, discount seekingPart 10
24Loyalty/Return PropensityReturn likelihood based on session patterns and engagementPart 10
25Micro-Conversion ScoreCompletion of intermediate conversion stepsPart 10
26Bot/Fraud Detection ScoreBehavioral biometrics-based bot and fraud detectionPart 10

The Three-Phase Pipeline

Every incoming event flows through a three-phase pipeline before scores are updated. This pipeline is designed for incremental computation -- no event requires rescanning the full session history.

Phase 1: Event Ingestion & Normalization

Raw browser events (clicks, scrolls, mouse movements, form interactions, page transitions) arrive as JSON payloads at the edge worker. The ingestion phase normalizes timestamps, deduplicates rapid-fire events, and enriches each event with session context.

TypeScript
// Phase 1: Event normalization interface RawEvent { type: 'click' | 'scroll' | 'mousemove' | 'keypress' | 'pageview' | 'form' | 'visibility'; timestamp: number; target?: string; // CSS selector of interacted element position?: { x: number; y: number }; scrollDepth?: number; // 0-100 percentage formField?: string; // field identifier (never the value) pageUrl: string; viewport: { width: number; height: number }; }

Phase 2: Feature Extraction

Normalized events are fed into the feature extraction layer, which maintains running statistics and computes derived features. This layer produces a BehavioralFeatures object that serves as input for all 26 models.

TypeScript
interface BehavioralFeatures { // Temporal features sessionDuration: number; // ms since session start timeSinceLastEvent: number; // ms idle time eventRate: number; // events per second (rolling 30s window) pageViewCount: number; // total pages viewed avgTimeOnPage: number; // mean dwell time across pages // Interaction features clickCount: number; scrollDepthMax: number; // deepest scroll across session scrollDepthCurrent: number; // current page scroll depth scrollVelocity: number; // px/s average scroll speed mouseVelocity: number; // px/s average mouse speed mouseDistanceTotal: number; // total mouse travel in px // Navigation features backButtonCount: number; // browser back navigations revisitedPages: number; // unique pages visited > 1 time navigationPattern: 'linear' | 'exploratory' | 'bouncing' | 'focused'; // Engagement features formFieldsInteracted: number; formFieldsCompleted: number; tabVisibilityRatio: number; // % of session with tab visible // Error/frustration features rageClickCount: number; // 3+ clicks in 500ms on same element deadClickCount: number; // clicks with no DOM response errorEncounters: number; // JS errors, 4xx/5xx responses cursorThrashing: number; // rapid direction changes per second }

Phase 3: Model Scoring

The scoring phase takes the BehavioralFeatures object and the current SessionContext, runs all 26 models, and produces the final score set. Each model is a pure function: given the same features and context, it always returns the same scores.

TypeScript
interface SessionContext { visitorId: string; sessionId: string; isReturning: boolean; previousSessions: number; deviceType: 'desktop' | 'tablet' | 'mobile'; referrerCategory: 'direct' | 'search' | 'social' | 'email' | 'paid' | 'referral'; landingPageCategory: string; geoRegion: string; localHour: number; // 0-23 in visitor's timezone } interface BehavioralScores { intentScore: number; // 0-100 frustrationScore: number; // 0-100 engagementScore: number; // 0-100 valueEstimate: number; // 0-100 anomalyScore: number; // 0-100 confusionScore: number; // 0-100 emotionalState: string; // classified label decisionConfidence: number; // 0-100 regretRisk: number; // 0-100 churnPrediction: number; // 0-100 ltvScore: number; // 0-100 abandonmentScore: number; // 0-100 purchaseTiming: number; // 0-100 contentAffinity: Record<string, number>; // category affinities formFriction: number; // 0-100 nextAction: { action: string; confidence: number }; }

The clickstream_scores Dataset Schema

All computed scores are written to the clickstream_scores dataset in your configured data warehouse. This is the single source of truth for all behavioral intelligence and serves as the foundation for downstream analytics, alerts, and ML pipelines.

SQL
CREATE TABLE clickstream_scores ( -- Identity visitor_id STRING NOT NULL, session_id STRING NOT NULL, score_timestamp TIMESTAMP NOT NULL, edge_location STRING, -- Cloudflare colo code -- Core scores (0-100) intent_score FLOAT64, frustration_score FLOAT64, engagement_score FLOAT64, value_estimate FLOAT64, anomaly_score FLOAT64, confusion_score FLOAT64, emotional_state STRING, decision_confidence FLOAT64, regret_risk FLOAT64, churn_prediction FLOAT64, ltv_score FLOAT64, abandonment_score FLOAT64, purchase_timing FLOAT64, content_affinity JSON, form_friction FLOAT64, next_action STRING, next_action_confidence FLOAT64, -- Context device_type STRING, referrer_category STRING, landing_page STRING, geo_region STRING, session_duration INT64, -- ms at time of scoring page_view_count INT64, event_count INT64, -- Metadata model_version STRING, -- semver of scoring model pipeline_latency FLOAT64, -- ms from event to score write is_final BOOLEAN -- true for end-of-session snapshot ) PARTITION BY DATE(score_timestamp) CLUSTER BY visitor_id, session_id;

How Scores Flow Through the System

The pipeline operates as an event-driven loop. Here is the full lifecycle of a single behavioral event:

  1. Browser SDK captures a user interaction (click, scroll, page transition, form field interaction).
  2. Edge Worker receives the event at the nearest Cloudflare PoP (200+ locations globally).
  3. Session State is loaded from Durable Objects -- a persistent, co-located key-value store that holds the current BehavioralFeatures and SessionContext.
  4. Feature Update: The new event updates the running feature counters and statistics.
  5. Model Scoring: All 26 models re-score in parallel using the updated features. Each model is a deterministic function with no external dependencies.
  6. Score Emission: Updated scores are written to the clickstream_scores dataset via batched inserts (every 5 seconds or on significant score changes).
  7. Real-time Actions: If any score crosses a configured threshold, the worker triggers configured actions (webhooks, personalization rules, alert notifications).

The entire pipeline -- from event arrival to score emission -- averages 12ms at the p50 and 47ms at the p99. This is fast enough to modify the response for the current page load.

Design Principles

Several principles guide the design of every model in this series:

Incremental Computation

No model ever requires scanning the full event history. Every score can be updated from the previous score plus the new event. This keeps compute costs O(1) per event regardless of session length.

Weighted Signal Decay

Recent events carry more weight than older ones. Most models use an exponential decay function with a configurable half-life (typically 60–120 seconds). This means a rage-click 30 seconds ago matters more than one from 5 minutes ago.

Normalization to 0–100

All scores are normalized to a 0–100 scale using sigmoid functions calibrated on historical data. This makes scores directly comparable across models and easy to reason about in business rules.

Cross-Model Interaction

Models are not independent -- they inform each other. For example, a high frustration score suppresses the intent score (frustrated users are less likely to convert), while a high engagement score amplifies value estimates. These interactions are documented in each part of the series.

Configurable Thresholds

Every model exposes thresholds that can be tuned per-site. Default thresholds are calibrated on aggregate data across ClickStream deployments, but you can override them for your specific use case.

Series Index

This series is organized into ten parts, each covering two to four closely related models. The groupings reflect how models interact in practice -- understanding them together gives you a much richer picture than treating each in isolation.

PartModels CoveredKey Topics
Part 1Intent, Frustration, EngagementSignal weights, intent categories, 9 frustration signals, tab visibility, 4 behavioral archetypes, e-commerce walkthrough
Part 2Value Estimator, Anomaly DetectionE-commerce vs SaaS scoring, dual baseline comparison, bot detection formula, false positive mitigation
Part 3Confusion, Emotional State7 confusion signals, 4 confusion types, 6 emotional states, mouse dynamics, typing cadence, ethical considerations
Part 4Decision Confidence, Regret Risk7 confidence signals, convergence analysis, speed-research mismatch, price sensitivity, intervention strategies
Part 5Churn Prediction, LTV Score9 churn signals, SaaS vs e-commerce, 4 LTV tiers, priority matrix with actions, real-time intervention timeline
Part 6Abandonment, Purchase Timing8 abandonment signals, exit intent formula, latency breakdown, proximity scoring, urgency classification
Part 7Content Affinity, Form Friction, Next Action6 affinity types, 5 friction types, sequential pattern mining, personalization trinity
Part 8Session Momentum, Click Entropy, Attention ScoreProgression velocity, click randomness, tab focus, reading patterns, bot vs human signals
Part 9Conversion Probability, Hover Intent, Scroll Depth IntelligenceReal-time conversion likelihood, CTA hover patterns, scroll regression, content zone analysis
Part 10Price Sensitivity, Loyalty, Micro-Conversion, Bot DetectionComparison shopping, return propensity, funnel micro-steps, behavioral biometrics fraud detection

Prerequisites

This series assumes familiarity with:

No machine learning expertise is required. While the models are inspired by ML techniques, they are implemented as deterministic scoring functions that can be reasoned about directly.

Getting Started

Start with Part 1: Intent, Frustration & Engagement to understand the three foundational models, or jump directly to the model group most relevant to your use case using the series navigation above.

Each part is self-contained -- you can read them in any order -- but the cross-model interactions will make more sense if you have read the earlier parts first.

26 Scores That Tell You Exactly What Each Visitor Wants

Convert more visitors by understanding their intent, frustration, and buying signals in real time. Every score maps to a revenue action.

GET EARLY ACCESS