Helm Analytics Python SDK
Official Python middleware for Helm Analytics. Track server-side events, verify traffic quality, and bypass ad-blockers by ingesting data directly from your backend.
Installation
pip install helm-analytics
Quick Start (FastAPI)
from fastapi import FastAPI
from starlette.middleware.base import BaseHTTPMiddleware
from helm_analytics import HelmAnalytics
app = FastAPI()
# Initialize Helm
helm = HelmAnalytics(site_id="YOUR_SITE_ID_HERE")
# Register Middleware
app.add_middleware(BaseHTTPMiddleware, dispatch=helm.fastapi_dispatch)
@app.get("/")
def home():
return {"message": "Hello World"}
Shield Mode (Blocking)
Helm can actively block malicious requests (e.g. from banned IPs or countries) before they hit your logic.
# Flask
app.before_request(helm.flask_middleware(shield=True))
# FastAPI
app.add_middleware(BaseHTTPMiddleware, dispatch=helm.fastapi_middleware(shield=True))
Custom Event Tracking
Track meaningful milestones like signups, payments, or file exports:
@app.post("/signup")
def signup(request):
# ... logic ...
helm.track_event(request, "user_signup", {"plan": "premium"})
return {"status": "ok"}
Session Stitching
To link server-side events back to the browser session, pass the sessionId from your frontend (stored in sessionStorage as helm_session_id) in the X-Helm-Session-Id header of your API requests.
Features
- Non-blocking: Uses background threads to send data without slowing down your app.
- Shield Mode: Synchronously queries Helm to block threats at the edge.
- Custom Events: Track business milestones beyond simple pageviews.
- Session Stitching: Link server-side actions to web sessions via headers.
- Fail-safe: Failures in tracking do not crash your application.
Configuration
You can also set the Site ID via environment variable:
export HELM_SITE_ID="your-uuid"
Metadata
Release files for helm-analytics 5.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| helm_analytics-5.0.0.tar.gz | 4.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| helm_analytics-5.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.3 kB
Release files / helm_analytics-5.0.0.tar.gz
| Download URL | helm_analytics-5.0.0.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6d0ef4c42e34a08181a1b3520767bf42ba4c9992dc83606e8d30ff0a7cc42af5
|
|
BLAKE2b-256 checksum How to use checksums |
62e2b2b8d27ca4acfb2dbd61f87d17c825d35a39945f30d45d98297d278e072c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.11
|
Release files / helm_analytics-5.0.0-py3-none-any.whl
| Download URL | helm_analytics-5.0.0-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
12e669f171389b4a6e3950466ad3effcff766bd8b3987539af5ee4cff901ea87
|
|
BLAKE2b-256 checksum How to use checksums |
5a97e2a1d7301b01a8dabdc872d12404fe389a936dbd68d07b273476256ae2a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.11
|