State API
The State API resolves a live evaluation state object for the current visitor on page load. Use it to personalize onboarding, adapt CTAs, trigger workflows, and route evaluator state into your own systems in real time.
How it works
When jvx.js loads on your site, Jourvex resolves the current visitor and reconstructs their evaluation state across previous sessions automatically.
The resolved state object is passed into the stateReady callback on page load. No manual requests or backend setup required.
The object reflects Jourvex's latest understanding of that visitor's evaluation journey, including intent classification, session continuity, behavioral signals, and conversion state.
Basic usage
Register a callback using window.jourvex.on() to receive the state object once it resolves.
Add the queue stub before your Jourvex script so callbacks can register immediately during page initialization.
window.jourvex = window.jourvex || {
_queue: [],
on: function(event, cb) {
this._queue.push({ event, cb });
}
};
window.jourvex.on("stateReady", function(journey) {
console.log(journey);
// journey is the full evaluation state object
// use any field to branch your experience
});
You can also access the latest resolved state at any time using window.jourvex.getState().
const journey = window.jourvex.getState();
if (journey) {
console.log(journey.intent_state);
}
State object reference
Full schema returned by the State API.
{
"resolved": true,
"journey_id": "cluster_8f2ab",
"intent_state": "high",
"intent_score": 82,
"sessions": 6,
"converted": false,
"channel": "linkedin",
"archetype": "high_intent_prepare",
"signals": {
"pricing_views": 3,
"high_intent_hits": 7,
"enterprise_hits": 1,
"days_since_last_seen": 0
}
}
Field reference
resolved
journey_id
intent_state
high, medium, or low.
intent_score
sessions
converted
channel
archetype
signals.pricing_views
signals.high_intent_hits
signals.enterprise_hits
signals.days_since_last_seen
Branching on evaluation state
The state object is designed for direct frontend branching. Most teams use it to adapt onboarding flows, swap CTAs, trigger internal routing, or personalize experiences based on live evaluator state.
window.jourvex.on("stateReady", function(journey) {
// High intent evaluator
if (journey.intent_state === "high" && !journey.converted) {
const cta = document.getElementById("primary-cta");
if (cta) {
cta.textContent = "Start your pilot";
}
}
// Returning evaluator
if (journey.sessions >= 3 && !journey.converted) {
const banner = document.getElementById("returning-banner");
if (banner) {
banner.style.display = "block";
}
}
// Enterprise evaluator
if (journey.signals.enterprise_hits >= 1) {
const enterprise = document.getElementById("enterprise-contact");
if (enterprise) {
enterprise.style.display = "block";
}
}
// LinkedIn traffic personalization
if (journey.channel === "linkedin") {
const hero = document.getElementById("hero-subtext");
if (hero) {
hero.textContent =
"Used by modern B2B GTM teams running high-volume evaluation traffic.";
}
}
// Forward evaluator state into your own backend
if (
journey.intent_state === "high" ||
journey.sessions >= 3
) {
fetch("https://your-backend.com/jourvex/state", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
keepalive: true,
body: JSON.stringify({
journey_id: journey.journey_id,
intent_state: journey.intent_state,
intent_score: journey.intent_score,
sessions: journey.sessions,
converted: journey.converted,
channel: journey.channel,
archetype: journey.archetype,
signals: journey.signals
})
});
}
});
When state updates
Evaluation state updates after sessions are processed and stitched into the visitor journey.
In most cases this happens within a few minutes after session activity ends.
On future visits the latest available state resolves immediately on page load, allowing onboarding, messaging, and workflows to adapt from the start of the session.
State does not continuously mutate live during a single browsing session. Updates reflect completed session processing.
Combining with the Journey API
The State API is optimized for lightweight real-time branching.
When you need the complete evaluator timeline, including full session history and event-level reconstruction, use the journey_id to fetch the full journey object from your backend through the Journey API.
See the Journey API and Examples pages for complete workflow implementations.
Rate limits
GET /api/state/{identity}
jvx.js during page initialization.