Python SDK
Track your data via the Python SDK for Vemetric.
Below you can see how to initialize and configure the SDK, as well as all the available functions.
The Python SDK doesn’t track your page visitors and is meant as a complement to the Frontend SDKs.
Installation
Install the SDK
In your project directory, run:
Initialize the Vemetric Client
We recommend creating a single instance of the Vemetric client and reusing it throughout your application.
Replace
YOUR_PROJECT_TOKEN
with the unique token for your project (found in the project settings).
If you’re using a proxy to track data via your own domain, you can pass the
host
option to the client with e.g.https://hub.yourdomain.com
.
Methods
Below you can find all the available methods and their functionality.
trackEvent
The main method to track any kind of event.
You need to pass the following parameters:
event_name
: Required: The name of the event to track.user_identifier
: Required: The identifier of the user to associate the event with.event_data
: Optional: A dictionary containing the meta data of the event so you can later filter byuser_data
: Optional: A dictionary to update the user data.set
: A dictionary containing the user data to set, overriding existing values.setOnce
: A dictionary containing the user data to set once, only if the keys do not exist yet.unset
: A list of keys to remove from the user data.
Checkout the tracking custom events section to learn more.
updateUser
Updates the data of the user with the given identifier.
In order to change the data of the user you can pass a user_data
dictionary with the following properties:
set
: A dictionary containing the user data to set, overriding existing values.setOnce
: A dictionary containing the user data to set once, only if the keys do not exist yet.unset
: A list of keys to remove from the user data.
Resources
View the Package of the Python SDK.
View the source code of the Python SDK on GitHub.