/api/journey_markov

Header
POST https://api.Fluxrails.app/api/v1/ai/journey_markov
X-Customer-Api-Id: <uuid>
X-Secret: <secret>
Content-Type: application/json
Request Body Schema
// Request Body Schema
{
  "absorb_on": "string",           // Label for the success absorbing state (e.g. "Conversion")
  "sessions": [                    // Array of session objects
    {
      "session_id": "string",      // Optional, for debugging/tracing
      "steps": ["string", …],      // Ordered list of unique step labels
      "converted": 0|1             // 1 = session succeeded; 0 = session ends in "EXIT"
    }
  ]
}
Example Request Body
// Example Request
{
  "absorb_on": "Conversion",
  "sessions": [
    { "session_id": "S-001", "steps": ["Landing","Search","PDP","Cart"], "converted": 1 },
    { "session_id": "S-002", "steps": ["Landing","Search"],              "converted": 0 },
    { "session_id": "S-003", "steps": ["Landing","Promo","PDP"],         "converted": 1 },
    { "session_id": "S-004", "steps": ["Landing"],                       "converted": 0 },
    { "session_id": "S-005", "steps": ["Landing","Search","PDP"],        "converted": 0 }
    // … include all your sessions …
  ]
}
Example Response Body
// Example Response
{
  "transitions": [
    { "from_step": "Cart",      "to_step": "Conversion", "probability": 1.0    },
    { "from_step": "Landing",   "to_step": "Promo",      "probability": 0.24   },
    { "from_step": "Landing",   "to_step": "Search",     "probability": 0.65   },
    { "from_step": "PDP",       "to_step": "Cart",       "probability": 0.5652 },
    { "from_step": "PDP",       "to_step": "Conversion", "probability": 0.2899 },
    { "from_step": "Promo",     "to_step": "PDP",        "probability": 0.5833 },
    { "from_step": "Search",    "to_step": "PDP",        "probability": 0.8462 }
  ],
  "drop_off_probs": {
    "Landing":    0.11,
    "Search":     0.1538,
    "Promo":      0.4167,
    "PDP":        0.1449,
    "Cart":       0.0,
    "Conversion": 1.0
  },
  "interpretation": "Highest drop-off is after **Promo** (41.7%). Next steps: optimise promo-to-PDP flow and monitor average journey depth (2.97 steps)."
}
Description

• Converts raw click-stream sessions into a Markov-chain funnel. • Returns per-step transition probabilities and drop-off rates. • Auto-appends absorbing states for success ("Conversion") and failure ("EXIT"). • Provides a natural-language summary of top bottlenecks and average path length.

Business Usage

• Identify which funnel steps leak the most traffic and prioritise UX fixes. • Estimate probability of reaching critical stages (e.g. PDP → Cart). • Benchmark different variants (by device, region, campaign) with one API call. • Track improvements by comparing transition/dropp-off deltas over time.

← Back to all routes