Funnel Leak Diagnosis

Company AI: the funnel names its biggest drop, and for any slice (source, campaign, device, country, landing page) a calibrated conversion rate arrives with the conditions that pull it up or down and the lever that moves it. E-commerce: per traffic source, counted conversion and how many new customers stay, with Aito's predicted stay rate and what each source's visitors land on.

Funnel Leak Diagnosis: screenshot from the E-commerce demo
🛒 E-commerce_predict_relate_recommend_queryCross-vertical
In the demoOn Company AI's synthetic funnel, 600 visitors become 36 paying customers, the biggest drop is from trial to paid, and referral traffic converts at 14% against 5% for the rest. In the e-commerce demo's generated shop, affiliate traffic converts at least as well as organic search (3.5 % against 3.0 %), but only about a third as many of its new customers become regulars within six months (21.5 % against 69 %), an effect planted in the data for the view to find.

The problem

A funnel chart shows where people drop off. It does not say why, or which change would help, and the slice someone wants to look at next (mobile visitors from one campaign, say) is rarely the one the dashboard was built for.

How it works

The stage counts are plain queries. In the Company AI demo, for the chosen slice, _predict gives the calibrated probability of converting, _relate lists the conditions that travel with converting or not (the why-it-leaks list), and _recommend names the value of a lever, here the traffic source, most likely to lift it. Changing a filter re-asks all three; nothing is precomputed. The e-commerce demo's Acquisition view works per traffic source: conversion and the share who become regulars are counted with intervals, _predict gives each source's chance that a new customer becomes a regular with the source's lift from $why, and _relate lists where each source's visitors land and which first-basket categories go with staying.

For the full architecture, see the technology overview. For the broader narrative across multiple use cases, read The Predictive Application. For the whole picture, see predictive e-commerce.

See it live

This use case runs in the 🛒 E-commerce demo today. Click through to the live application and inspect the queries that produce the result.

Open the live demo →

It also runs in Company AI, a reference application you run yourself. There is no hosted demo, so the link opens its illustrated tour and source on GitHub: Company AI tour on GitHub →

Build it with Claude Code

Paste this prompt into Claude Code, or another coding agent, in your own codebase. It runs Aito locally from the Docker image, reads the API docs written for agents, and follows a working reference implementation.

Funnel leak diagnosis: a prompt for Claude Code
Add funnel leak diagnosis to this codebase using Aito, a predictive database. The feature: show, per traffic source, the counted conversion rate with its interval and the predicted chance that a new customer becomes a regular, with the conditions that go with it, from our sessions and customers.

1. Run Aito locally: `docker pull ghcr.io/aitohq/aito`, then follow https://aito.ai/docker/ to start it with your own API keys (keep them in the environment, never in code).
2. Read https://aito.ai/docs/api/llms.txt for the v2 query shapes before writing any query.
3. Read the use-case guide: https://aito.ai/use-cases/funnel-leak-diagnosis/
4. Use this reference implementation as the pattern (schema, data load and queries): https://github.com/AitoDotAI/aito-ecommerce-demo/blob/main/src/acquisition_service.py and https://github.com/AitoDotAI/aito-ecommerce-demo/blob/main/src/lift_rows.py
5. Find the matching tables in this codebase, design the Aito schema for them (links between tables where we have foreign keys), and load a sample.
6. Check the numbers before building the view: compare a few of them against a direct count over the same rows (SQL or a short script), and report any that differ.
7. In the UI, show the evidence behind each number (the counts, the interval or $why), and leave out patterns with too little data behind them.

Ask me before changing anything outside the new feature.