Anomaly Detection

Anomaly detection is a method for spotting unusual behavior in your data—values that deviate from an expected baseline. In web analytics, it helps you catch sudden drops in Conversion Rate, traffic spikes from a bot storm, or a broken step in a Goal Funnel before it burns your budget. Instead of staring at charts, you define “normal,” watch variance around it, and auto-flag outliers for investigation.

Why it matters in web analytics

Teams track KPI (Key Performance Indicator) trends over time. Real traffic is noisy: day-of-week effects, seasonality, and campaign bursts. Anomaly detection filters the noise so you act only when a metric moves in a statistically meaningful way. Use it on engagement metrics (Bounce Rate, Engagement Rate), ecommerce outcomes, or per User Segment cohorts—segment-level anomalies often surface issues hidden in aggregate Session data.

Common approaches (quick map)

  • Static thresholds: flag when a metric crosses a fixed limit. Fast, but brittle.
  • Z-score (sigma) rules: compute how many standard deviations a value is from the baseline mean. Good default.
  • Robust stats: medians + MAD (median absolute deviation) to resist outliers.
  • Seasonal models: learn weekly/annual patterns and flag residuals (what’s “weird” after seasonality).
  • Multivariate checks: monitor several metrics together (e.g., traffic + CVR) to reduce false positives.

Simple formula

For a metric xxx: z=x−μσz = \frac{x – \mu}{\sigma}z=σx−μ​

where μ\muμ is the rolling baseline mean and σ\sigmaσ is the rolling standard deviation. A common rule of thumb: flag if ∣z∣≥3|z| \ge 3∣z∣≥3.

Mini example (sessions):

DateValueBaseline μBaseline σz-scoreAnomaly?
2025-08-101,2001,2001500.00
2025-08-111,1751,200150−0.17
2025-08-121,7501,2001503.67✅ Yes

Practical tips

  • Use rolling windows aligned to behavior (e.g., last 28 days).
  • Model seasonality (weekday vs weekend) to avoid false alarms.
  • Alert on both negative and positive anomalies; a “too good to be true” spike can be bot traffic.
  • Scope by Cohort Analysis or channel; local anomalies beat one-size-fits-all.