The Python SDK makes it easy to track events from Python applications.
Installation
The Python SDK can be installed via
pypi.org.
To initialize the Python SDK in your application, import htevents and set the write_key:
API
Identify
The identify method sends an identify event.
Unlike the Browser SDK, it does not persist the user ID and
traits locally, so user IDs must be explicitly added to other events. This is
because server side events are usually servicing many different users at once.
Example usage:
Method parameters:
Track
The track method sends a track event.
Example usage:
Method parameters:
Page
The page method sends a page event.
Example usage:
Method parameters:
Screen
The screen method sends a screen event.
Example usage:
Method parameters:
Group
The group method sends a group event.
Example usage:
Method parameters:
Flush
The Python SDK buffers events locally before sending them to Hightouch’s servers.
This minimizes the number of requests made by the SDK and makes the tracking
non-blocking.
To force the local buffer to be sent to Hightouch immediately call the flush
method. flush should be called when shutting down your Python app to
make sure no events are lost.
Example usage:
Last modified on March 12, 2024