Predict docs
Ask what a visitor will do next.
Predict reads page activity and returns one suggested next step. Your site decides what to show.
Install your own Worker on GitHub →
Install
Use the hosted snippet to test Predict. The hosted service limits requests. Use it for evaluation.
<script src="https://predict.coey.dev/snippet.js"></script>Use the hosted snippet to try Predict. Deploy the Worker when you need your own endpoint and limits.
Make your first prediction
const prediction = await Predict({
action: "pricing_confusion",
outcomes: ["compare", "clarify", "none"],
metadata: {
experiment: "comparison-v2"
}
}); action is the only required field. Use it to name the event that caused the request. outcomes is optional. When you send it, Jev chooses one value from the list. endpoint defaults to "/predict". You can set it to your Worker URL. session is optional. If you omit it, the Worker creates a UUID. metadata is optional context from your site.
Input schema
{
action: string,
endpoint?: string,
session?: string,
outcomes?: string[],
metadata?: object
} Predict builds page, engagement, motion, and form data in the browser. It sends your metadata with that data to help Jev choose an outcome. Do not send secrets, form values, or sensitive personal data.
Add context and choices
metadata: {
plan: "team",
experiment: "comparison-v2"
} Metadata comes from your site. Predict sends it with the request. Do not send form values, secrets, or sensitive personal data.
Send the result to your analytics
Predict returns a result. Your site decides whether to record it. Send the fields you need to your analytics system.
analytics.track("prediction_received", {
action: prediction.reason,
outcome: prediction.next,
confidence: prediction.confidence
}); Take action in your code
Predict does not change your page. Your code decides what each outcome does.
if (prediction.next === "compare") {
showPlanComparison();
}
if (prediction.next === "clarify") {
showHelpfulHint();
} Output schema
{
next: string,
confidence: number,
reason: string,
model: string,
t: number,
heads: {
bounce: { noul: number, mode: "engaged" | "stalled" | "exiting", mode_p: Record<string, number> },
intent: { choice: string, confidence: number },
friction: { confused: number, rage: number, abandon_form: number },
interrupt: { noul: number },
next: { choice: string, confidence: number }
}
} next is one of the outcomes you supplied. confidence is Jev's confidence in that choice. heads.bounce estimates whether the visitor may leave and describes their current posture. The other heads provide intent, friction, and interruption signals. Your code decides whether to act.
Choose your action label
Actions are open labels from your site. Name them after the event that caused the prediction request. Supply the possible next values in outcomes. Jev chooses the most probable value from that list.
action: "pricing_confusion"
action: "checkout_stall"
action: "returning_customer" The response repeats your action in reason. The response field next is separate. It is the outcome Jev selected.
Metadata is limited to JSON objects up to 8 KB. Predict does not store it by default.
Deploy it yourself
Install the Worker in your Cloudflare account when you need your own endpoint. Your account controls billing and limits. You can use any action label from your site.