Overview
score() returns a risk assessment for a user — a 0–1 score, a tier classification, the signals driving the score, and a recommendation for what to do.
Signature
Parameters
The user to score.
Cancel the request.
RiskScore
Score tiers
| Tier | Range | Meaning |
|---|---|---|
'low' | 0.0 – 0.39 | Healthy — no action needed |
'medium' | 0.4 – 0.69 | Watch — consider a check-in |
'high' | 0.7 – 1.0 | At-risk — act immediately |
Example signals
no_login_7d— no login in 7 daysno_login_14d— no login in 14 daysfeature_usage_drop— feature usage fell >50% week-over-weeksupport_spike— 3+ support tickets in 7 daysexport_all_data— exported all data (exit intent signal)cancellation_page_viewed— viewed the cancellation pagebilling_failed— recent payment failuretrial_expiring— trial expires within 3 daysdowngrade_initiated— initiated a plan downgrade
Examples
Get risk score
Conditional action based on tier
In a cron job
With abort on timeout
Errors
| Code | When |
|---|---|
VALIDATION_ERROR | userId is empty |
NOT_FOUND | User has no tracked events — score cannot be computed |
UNAUTHORIZED | API key invalid |
TIMEOUT | Request exceeded timeout |