Official Python SDK for Altertable Product Analytics.
You can install the package via pip:
pip install altertableOr using poetry:
poetry add altertablefrom altertable import Altertable
client = Altertable("your_api_key")client.track(
event="button_clicked",
distinct_id="user_123",
options={
"properties": {
"button_id": "signup_btn",
"page": "home"
}
}
)Server applications can submit a caller-managed batch directly. The SDK does not impose a client-side batch-size limit.
client.track([
{"event": "button_clicked", "distinct_id": "user_123", "environment": "production"},
{"event": "checkout_started", "distinct_id": "user_123", "environment": "production"},
])Pass arrays to identify and alias for the same pass-through behavior.
client.identify(
distinct_id="user_123",
options={
"traits": {
"email": "user@example.com",
"name": "John Doe"
},
"anonymous_id": "previous_anon_id"
}
)client.alias(
distinct_id="previous_anonymous_id",
new_user_id="new_user_id"
)The package is available as open source under the terms of the MIT License.