Server SDKs
Client Setup
Initialize the Python SDK client and user data
Before sending any events, create a Client instance and prepare a UserData object.
Client
from audiencelab_python_sdk import Client
client = Client(
api_key="GeekA1B2C3D4-5678-9012-abcd-ef1234567890",
base_url="https://analytics.geeklab.app"
)Prop
Type
UserData
The UserData object holds device information and identity fields used across all API calls.
from audiencelab_python_sdk import UserData
user_data = UserData()
user_data.set_user_id("user_12345")
user_data.set_user_ip("203.0.113.42")
user_data.set_event_timestamp("2025-03-11T10:15:00.000Z")
user_data.set_device_info({
"device_name": "iPhone 14 Pro",
"device_model": "iPhone15,2",
"os": "iOS",
"os_version": "17.4",
"height": 852,
"width": 393,
"timezone": "Europe/Helsinki",
})
user_data.set_app_version("2.5.1")
user_data.set_dev(False)
user_data.set_ifv("6D92078A-8246-4BA4-AE5B-76104861E7DC")
user_data.set_whitelisted_properties({ "subscription_tier": "gold" })
user_data.set_session_context("f47ac10b-58cc-4372-a567-0e02b2c3d479", 1)Manage whitelisted properties with set_whitelisted_property, set_whitelisted_properties, unset_whitelisted_property, clear_whitelisted_properties, and get_whitelisted_properties. They are persisted as wp and sent on registration and app-event requests. Customer properties are limited to 50 keys, 64 characters per key, 256 characters per string value, and 2048 serialized bytes. Keys beginning with _ are reserved for backend-returned properties.
Prop
Type
Device Info
Prop
Type
IP Forwarding
Always forward the end-user's actual IP address, not your server's IP. This is critical for accurate geo-location and attribution matching.
Creative Token Info
The creative token is issued by the AudienceLab backend — you never set it yourself. Register the user (first launch) or fetch the token (returning user), then pass the response back into UserData:
response = RegisterUser(client, user_data).send()
user_data.set_user_creative_token_info(response)set_user_creative_token_info(response) reads the creative_token, retention state, and cumulative values from the backend response and stores them on user_data for subsequent event calls. If the response includes wp, it is merged into the SDK property state without overwriting caller-set properties. Reserved _ keys can come from backend responses, but customer API calls cannot set or unset them.
See Register User for first launch and Fetch Token for returning users.
Blacklisted Properties
Blacklisted properties (bp) are never stored on UserData. Pass them only on the specific AppEvent(..., blacklisted_properties={...}) call that needs to send those values.