Decisions
How Pique evaluates visitor sessions and makes actionable recommendations.
When a visitor's session ends, Pique evaluates the session and makes a decision about what action to take. Decisions combine deterministic rules with LLM reasoning to produce actionable recommendations delivered via webhooks.
Session windowing
Pique groups events into sessions using an idle timeout. When a visitor stops sending events (including heartbeats) for longer than the timeout, the session is closed and evaluated.
The default idle timeout is 5 minutes (300,000ms). You can change this in your project's decision configuration. The tracker sends heartbeat events every 30 seconds while the tab is visible, so a session stays open as long as the visitor has your site in the foreground.
Sessions also require a minimum number of meaningful events (default: 2) before evaluation. Heartbeat and session_end events don't count toward this minimum.
Built-in rules
Pique ships with four built-in rules that are evaluated in order. The first matching rule wins.
| Action | Condition |
|---|---|
cart_abandonment | Visitor added items to cart but did not purchase |
browse_abandonment | Viewed 3+ products without adding anything to cart |
price_sensitive | Average product price in the second half of the session dropped 30%+ compared to the first half |
gentle_nudge | Viewed 1-2 products with 15+ seconds of engagement, no cart activity |
Sessions where the visitor completed a purchase are skipped entirely — no decision is made.
Custom rules
You can create custom rules in Settings → Rules. Custom rules are evaluated before built-in rules, so they take priority.
Each custom rule has:
- Conditions — a list of field/operator/value checks against the session summary (e.g.,
productsViewed gt 5) - Action name — the action string sent in the webhook
- Reason template — supports
{{field}}interpolation from the session summary - Priority — higher-priority rules are evaluated first
Available operators: gt, gte, lt, lte, eq, neq, contains.
Available session summary fields: totalEvents, pageViews, productsViewed, addedToCart, purchases, durationSeconds, avgPrice, priceRange.min, priceRange.max, email.
LLM reasoning
After a rule matches, Pique sends the session summary and the matched action to Claude (Haiku by default) to generate a 2-3 sentence explanation of the decision. This reasoning is included in the webhook payload as decision.llmReasoning.
The LLM doesn't choose the action — rules do. The LLM provides context and insight about why the decision makes sense for this particular visitor's session, which is useful for customer-facing email copy or internal review.
Custom prompts
You can provide a custom prompt in your decision configuration to influence how the LLM reasons about sessions. This is appended to the system context when generating reasoning.
Use this to provide brand context, tone guidance, or specific instructions. For example:
We are a premium skincare brand. Our customers value quality
over price. When reasoning about price sensitivity, emphasize
that we can offer product bundles rather than discounts.
Set this in Settings → Decision Configuration → Custom Prompt.