Python
Python SDK
The Evntaly Python SDK offers a seamless and flexible way to integrate event tracking, user identification, and analytics into your backend Python applications.
Installation
Install the Evntaly Python SDK using pip:
pip install evntaly-python
Initialization
Initialize the SDK with your Developer Secret and Project Token - Check Here
from evntaly_python import EvntalySDK
evntaly = EvntalySDK("YOUR_DEVELOPER_SECRET", "YOUR_PROJECT_TOKEN")
Tracking Events
For custom event tracking, use the track method.
evntaly.track({
"title": "Payment Received",
"description": "User completed a purchase",
"message": "Order #12345",
"data": {
"user_id": "67890",
"timestamp": "2025-01-08T09:30:00Z",
"referrer": "social_media",
"email_verified": True
},
"tags": ["purchase", "payment"],
"notify": True,
"icon": "💰",
"apply_rule_only": False,
"user": {"id": "0f6934fd-99c0-41ca-84f4"},
"type": "Transaction",
"sessionID": "20750ebc-dabf-4fd4-9498-443bf30d6095_bsd",
"feature": "Checkout",
"topic": "@Sales"
})
User Identification
Identify a user to associate events with a specific profile.
evntaly.identify_user({
"id": "0f6934fd-99c0-41ca-84f4",
"email": "user@example.com",
"full_name": "John Doe",
"organization": "ExampleCorp",
"data": {
"id": "JohnD",
"email": "user@example.com",
"location": "USA",
"salary": 75000,
"timezone": "America/New_York"
}
})
Enabling and Disabling Tracking
You can enable or disable event tracking globally.
# Disable tracking
evntaly.disable_tracking()
# Enable tracking
evntaly.enable_tracking()
Methods
track
Tracks a custom event.
evntaly.track({"title": 'Event'})
v1.0.0
identifyUser
Identifies a user for analytics.
evntaly.identify_user({"id": 'user-123'})
v1.0.0
disableTracking
Disables all event tracking.
evntaly.disable_tracking()
v1.0.0
enableTracking
Enables all event tracking.
evntaly.enable_tracking()
v1.0.0
Best Practices
Initialize early: Always initialize the SDK as early as possible.
Avoid sensitive data: Do not pass sensitive personal data directly to the SDK.
Monitor API limits: Regularly check API limits to avoid missing critical events.
Troubleshooting
Events not appearing: Check if the SDK is initialized correctly and the API tokens are valid.
Network errors: Ensure your network allows requests to
https://evntaly.com
.
Support
For additional help, contact support at support@evntaly.com.
Last updated