Official SKAWR Analytics SDK for Python — server-side event tracking.
Project description
skawr-analytics (Python)
Server-side SDK for SKAWR Analytics. Stateless, pluggable HTTP backend, type-hinted, Python 3.9+.
Install
pip install skawr-analytics
# Or with the default `requests` backend bundled:
pip install 'skawr-analytics[requests]'
Quickstart
from skawr_analytics import Skawr
skawr = Skawr(api_key="ska_xxxxxxxxxxxx")
# In your request handler:
skawr.track(
"order_placed",
user_id=request.user.id,
properties={"value": 99.50, "currency": "SAR"},
)
# On login:
skawr.identify(
user_id="u_42",
anonymous_id=request.cookies.get("skawr_anon"),
properties={"plan": "pro"},
)
Configuration
Skawr(
api_key="ska_...", # required
endpoint="https://analytics-api.skawr.com", # override
timeout=5.0, # seconds
default_properties={"app": "api", "env": "prod"}, # merged into every event
http_post=my_async_post, # plug in httpx, custom transport, mocks
)
API
skawr.track(
event_name,
user_id=None,
anonymous_id=None,
session_id=None,
properties=None,
timestamp=None, # datetime / float / str / None
page_url=None,
referrer_url=None,
utm_source=None,
utm_medium=None,
utm_campaign=None,
) -> int # HTTP status
skawr.identify(user_id, anonymous_id, properties=None) -> int
timestamp accepts datetime (naive treated as UTC), POSIX float, or ISO-8601 string. Defaults to datetime.now(UTC).
Custom HTTP backend
Pass any callable with signature (url, headers, body) -> response_with_status_code. Useful for:
- httpx — for async or HTTP/2:
import httpx client = httpx.Client(timeout=5.0) def post(url, headers, body): return client.post(url, headers=headers, content=body) Skawr(api_key="...", http_post=post)
- Tests — record requests, return canned responses.
- Custom retry / queue — wrap a worker that buffers and retries on failure.
Why server-side?
- Trusted user_ids. Browser clients can't be trusted with revenue events; do those server-side.
- Backend-only events. Webhook receipts, payment confirmations, scheduled jobs.
- Defense-in-depth. Send the same event from both browser and server; dedupe later.
Development
pip install -e '.[dev]'
pytest
ruff check src
mypy src
License
MIT.
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 skawr_analytics-0.1.0.tar.gz.
File metadata
- Download URL: skawr_analytics-0.1.0.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74beb40df99d10d730f8c8e9f41047f08a12d11ec553b631a71e8c1da4c0d115
|
|
| MD5 |
beca04d628d6fb015c14d369c6371808
|
|
| BLAKE2b-256 |
2daa8d9090f14146f67b7ead30d21384aabdd6996cefd9a29732478b7cd10128
|
Provenance
The following attestation bundles were made for skawr_analytics-0.1.0.tar.gz:
Publisher:
publish-python-sdk.yml on LuqtahTech/skawr-analytics
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
skawr_analytics-0.1.0.tar.gz -
Subject digest:
74beb40df99d10d730f8c8e9f41047f08a12d11ec553b631a71e8c1da4c0d115 - Sigstore transparency entry: 2228275384
- Sigstore integration time:
-
Permalink:
LuqtahTech/skawr-analytics@6082347e4212ca171816bf1fc99029e424670778 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/LuqtahTech
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python-sdk.yml@6082347e4212ca171816bf1fc99029e424670778 -
Trigger Event:
push
-
Statement type:
File details
Details for the file skawr_analytics-0.1.0-py3-none-any.whl.
File metadata
- Download URL: skawr_analytics-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0c81c645f32d3f147309c4af19c6e1df8cf110ba18d182207a12cdfcf7cf486
|
|
| MD5 |
4ffe004f3bd0b964940830e48c3c9fea
|
|
| BLAKE2b-256 |
1505a3afb1d0ac77cad007b1607cbe463b10142067832ef22a4023764827dd47
|
Provenance
The following attestation bundles were made for skawr_analytics-0.1.0-py3-none-any.whl:
Publisher:
publish-python-sdk.yml on LuqtahTech/skawr-analytics
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
skawr_analytics-0.1.0-py3-none-any.whl -
Subject digest:
b0c81c645f32d3f147309c4af19c6e1df8cf110ba18d182207a12cdfcf7cf486 - Sigstore transparency entry: 2228275770
- Sigstore integration time:
-
Permalink:
LuqtahTech/skawr-analytics@6082347e4212ca171816bf1fc99029e424670778 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/LuqtahTech
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python-sdk.yml@6082347e4212ca171816bf1fc99029e424670778 -
Trigger Event:
push
-
Statement type: