Retentioneering is a Python library for user retention and clickstream analysis, with interactive DuckDB-backed Eventstream analysis and Jupyter widgets.
Project description
What is Retentioneering?
Retentioneering is a Python library for behavioral analytics on event data: clickstreams, product event logs, user paths. Where funnels tell you what happened, retentioneering shows how users actually behave — real paths to conversion, loops and dead ends, behavioral segments, and the differences in behavior between any two groups of users.
It runs on your raw data (a pandas DataFrame or CSV is enough), and renders interactive widgets right in Jupyter — no SaaS, no data leaving your machine.
Version 5.0 is a ground-up rewrite. The pandas engine and CDN-loaded
widgets of 3.x were replaced with a DuckDB-backed Eventstream, a new
generation of open-source anywidget-based widgets,
and an MCP server that lets LLM agents run analyses on your eventstream. See
CHANGELOG.md for the full 3.3.0 → 5.0 delta; the legacy 3.x
engine lives on the 3.x branch.
Documentation
Complete documentation is available at https://retentioneering.com/docs.
Installation
Python 3.11+ is required.
pip install retentioneering
Or directly from a Jupyter (Lab, Notebook, Desktop) / Google Colab / VS Code:
!pip install retentioneering
Quick start
All you need is a DataFrame with three columns: a path identifier, an event name, and a timestamp. (Different column names? Pass a schema.)
import pandas as pd
from retentioneering import Eventstream
df = pd.read_csv("events.csv") # columns: user_id, event, timestamp
stream = Eventstream(df)
stream.transition_graph() # interactive behavior graph, right in the notebook
No data at hand? Use the bundled synthetic e-commerce dataset:
from retentioneering.datasets.ecom import load_ecom
from retentioneering import Eventstream
ecom = Eventstream(load_ecom(), schema={
"path_cols": ["user_id", "session_id"],
"segment_cols": ["platform", "acquisition_channel"],
})
ecom.funnel(steps=["catalog", "add_to_cart", "purchase"])
# Compare two segments in one picture (diff mode)
ecom.transition_graph(diff=["platform", "mobile", "desktop"])
Clean and shape the data by chaining data processors — every step returns a
new Eventstream, the original is never modified:
clean = (
stream
.filter_events(drop={"event": ["bot_ping"]})
.collapse_events(consecutive=True)
.split_sessions(timeout="30m")
)
clean.step_matrix(path_pattern=".*->add_to_cart->.*->purchase")
Need raw numbers instead of a widget? Every widget has a headless twin:
tm = stream.transition_graph_data(edge_weight="proba_out") # DataFrame
funnel = stream.funnel_data(steps=["catalog", "add_to_cart", "purchase"]) # dict
What's inside
- Interactive widgets for Jupyter — Transition Graph, Step Matrix, Step Sankey, Funnel, Segment Overview, Cluster Analysis. Every parameter is also editable live in the widget sidebar, and every widget exports to a self-contained interactive HTML file.
- Diff mode in every widget — overlay two segments (
["plan", "pro", "free"], or a segment vs. everyone else via"<REST>") to see how behavior differs, not just that a metric moved. - Data processors — chainable, SQL-powered preprocessing: filtering events and paths, sessionization, collapsing noise, synthetic events (incl. churn markers), segments, URL parsing, daily lifecycle states, sampling.
- Path metrics — one
registry of per-path metrics that feeds behavioral clustering, segment
comparison, path filtering, and your own ML feature pipelines
(
stream.get_metrics()). - MCP server —
retentioneering.mcp.serve(stream)exposes the eventstream to Claude or any MCP client: agents explore the data, build report tabs, and export a validated interactive HTML report where every number links to its source.
Contributing
This is a community-driven open source project in active development. Any contributions — new ideas, bug reports, bug fixes, documentation improvements — are very welcome. See CONTRIBUTING.md for the local development setup.
Apps are better with math! :) Retentioneering is a research laboratory, analytics methodology and opensource tools founded by Maxim Godzi in 2015. Please feel free to contact us at retentioneering@gmail.com if you have any questions regarding this repo.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file retentioneering-5.0.0rc1.tar.gz.
File metadata
- Download URL: retentioneering-5.0.0rc1.tar.gz
- Upload date:
- Size: 1.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd9d1824a14c07a2f6a2183ac2a3f692219e1003a229f6c3d84cbabeddf75da5
|
|
| MD5 |
5e4e80433bb7bb7c3932b9fa37f7948f
|
|
| BLAKE2b-256 |
f4971c275791c9ba4cdd191ae041f5d72bb01785ef38370108c9487ed8db0f8d
|
File details
Details for the file retentioneering-5.0.0rc1-py3-none-any.whl.
File metadata
- Download URL: retentioneering-5.0.0rc1-py3-none-any.whl
- Upload date:
- Size: 1.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fcc2c9a720973ced807fb9938fb6d5954a5fbca9a479713dd5d006fe1aa245e0
|
|
| MD5 |
5047e40e7eb165b8abc6410862de09dc
|
|
| BLAKE2b-256 |
1b5e0b0a39b75c8ba31173f165b8a7cb93d8a438338bfa29ee9165a3592625f6
|