stapel-analytics
The backend half of the Stapel analytics standard. Your frontend already
declares its events and fires them through @stapel/analytics — typed
track(), a consent gate, an offline queue, provider fan-out. This is what
it talks to, and what the rest of your fleet talks to.
browser (@stapel/analytics) server modules
│ track / page / identify │ analytics.track
▼ ▼
POST /analytics/api/v1/events ──► registry check + PII guard
│
your comm Actions ──► COMM_BRIDGE ────────┤
(payment.completed, …) │
▼
stapel_core.eventstore ("analytics" stream)
│
┌────────────────────────┼────────────────────┐
▼ ▼ ▼
funnels / reports analytics.events.recorded erasure
(conversion by step) ──► adapter fan-out (GDPR Art. 17)
Part of the Stapel framework.
Install
pip install stapel-analytics
INSTALLED_APPS = [
...,
"stapel_core.django.eventstore", # the event rows live here
"stapel_analytics",
]
path("analytics/", include("stapel_analytics.urls")) # -> /analytics/api/v1/...
That is the whole install. Point your frontend's collector at it and events
start landing — the shipped stapelCollectorProvider needs no changes.
Declare your events once
The registry is the same analytics/events.json your frontend's
gen:events already produces:
STAPEL_ANALYTICS = {"EVENTS_FILE": BASE_DIR / "analytics" / "events.json"}
One vocabulary, two runtimes. An event nobody declared is still stored — and
marked unregistered, so you find the typo instead of losing the data.
Ask where people stop
STAPEL_ANALYTICS = {
"FUNNELS": {
"checkout": {
"title": "Checkout",
"steps": ["flow.checkout.started", "checkout.address",
"payment_completed"],
"window_seconds": 86400,
}
}
}
GET /analytics/api/v1/funnels/checkout/report?compare=true
{"entered": 1204, "completed": 331, "conversion": 0.274917,
"steps": [
{"name": "flow.checkout.started", "count": 1204, "rate_from_first": 1.0},
{"name": "checkout.address", "count": 502, "rate_from_previous": 0.416944,
"dropoff": 702, "delta": -48},
{"name": "payment_completed", "count": 331, "rate_from_previous": 0.659363,
"dropoff": 171, "delta": 12}
]}
Notice the last step: payment_completed happens on a server. One line
of settings makes it a step of the same funnel as the clicks before it:
STAPEL_ANALYTICS = {"COMM_BRIDGE": {"payment.completed": "payment_completed"}}
The user id is hashed exactly the way the browser hashes it, so the server step and the clicks belong to the same person.
Mirror the stream anywhere
STAPEL_ANALYTICS = {
"ADAPTERS": {
"webhook": {"enabled": True, "config": {"url": "https://collect…"}},
"posthog": {"handler": "app.analytics.posthog", "enabled": True},
}
}
Delivery rides the comm outbox, never the ingest request thread. A vendor's
outage costs you nothing: the event store is the record and
manage.py analytics_fanout --since … replays the mirror.
Privacy is the default, not a setting you remember
- prop values that look like an email or a phone number are refused, and the receipt names the offending prop;
- user ids are stored as a hash, never raw;
- the erasure provider ships in this same first release — analytics rows are personal data, including the anonymous session someone had before they logged in:
STAPEL_GDPR = {"DATA_OWNERS": [..., "analytics"]}
- and there is a retention horizon out of the box (400 days), with a system check if you turn it off.
Documentation
MODULE.md— the integration contract: wire format, settings, checks, comm surface, erasure policy.CONFIG.MD— every setting, and the four decisions a host actually has to make.CHANGELOG.md— what changed, and what breaks.
License
MIT
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 stapel_analytics-0.3.1.tar.gz.
File metadata
- Download URL: stapel_analytics-0.3.1.tar.gz
- Upload date:
- Size: 125.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
342e297564a061b3c15b5b7f2fdb98db4bd38679b6b3a911b58064c18faa6eee
|
|
| MD5 |
009c3576caa91d6fa681dda6636c88c1
|
|
| BLAKE2b-256 |
0c52ca68bb91e16d60dce007af137b6a2f2f887f5c0b65c3618fa4fd3aeeb3b4
|
Provenance
The following attestation bundles were made for stapel_analytics-0.3.1.tar.gz:
Publisher:
publish.yml on usestapel/stapel-analytics
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stapel_analytics-0.3.1.tar.gz -
Subject digest:
342e297564a061b3c15b5b7f2fdb98db4bd38679b6b3a911b58064c18faa6eee - Sigstore transparency entry: 2681821726
- Sigstore integration time:
-
Permalink:
usestapel/stapel-analytics@e0cb9d926396afe21a60b865063429da38883a00 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/usestapel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e0cb9d926396afe21a60b865063429da38883a00 -
Trigger Event:
push
-
Statement type:
File details
Details for the file stapel_analytics-0.3.1-py3-none-any.whl.
File metadata
- Download URL: stapel_analytics-0.3.1-py3-none-any.whl
- Upload date:
- Size: 104.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a4ae2f867a5f1f9ad97572cfcd5990d8af54d7b4a973e78f2a99c5a027406b1
|
|
| MD5 |
4923d288e59e99fdb08c2c0c02443de2
|
|
| BLAKE2b-256 |
fa8938f20688addd3c0412485598c6c29042ec9fa5efbbf9baf8ab58d12929a2
|
Provenance
The following attestation bundles were made for stapel_analytics-0.3.1-py3-none-any.whl:
Publisher:
publish.yml on usestapel/stapel-analytics
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stapel_analytics-0.3.1-py3-none-any.whl -
Subject digest:
0a4ae2f867a5f1f9ad97572cfcd5990d8af54d7b4a973e78f2a99c5a027406b1 - Sigstore transparency entry: 2681821748
- Sigstore integration time:
-
Permalink:
usestapel/stapel-analytics@e0cb9d926396afe21a60b865063429da38883a00 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/usestapel
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e0cb9d926396afe21a60b865063429da38883a00 -
Trigger Event:
push
-
Statement type: