Skip to main content

Official Python SDK for Helm Analytics

Project description

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"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

helm_analytics-5.0.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

helm_analytics-5.0.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file helm_analytics-5.0.0.tar.gz.

File metadata

  • Download URL: helm_analytics-5.0.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for helm_analytics-5.0.0.tar.gz
Algorithm Hash digest
SHA256 6d0ef4c42e34a08181a1b3520767bf42ba4c9992dc83606e8d30ff0a7cc42af5
MD5 1dd79429f75a63fdd0dd8f2511df0366
BLAKE2b-256 62e2b2b8d27ca4acfb2dbd61f87d17c825d35a39945f30d45d98297d278e072c

See more details on using hashes here.

File details

Details for the file helm_analytics-5.0.0-py3-none-any.whl.

File metadata

  • Download URL: helm_analytics-5.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for helm_analytics-5.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 12e669f171389b4a6e3950466ad3effcff766bd8b3987539af5ee4cff901ea87
MD5 14a11dcbec3a196868c178148dcaaf41
BLAKE2b-256 5a97e2a1d7301b01a8dabdc872d12404fe389a936dbd68d07b273476256ae2a4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page