Server SDKs

Custom Event

Send custom events with the Python SDK

Track game- or app-specific actions that are not covered by the built-in event types by sending a custom event via the webhook endpoint.

Usage

from audiencelab_python_sdk import (
    Client, UserData, CustomEventData, AppEvent, FetchToken
)

client = Client(
    api_key="YOUR_API_KEY",
    base_url="https://analytics.geeklab.app"
)

user_data = UserData()
user_data.set_user_id("user_12345")
user_data.set_user_ip("203.0.113.42")

# Fetch the creative token first to hydrate user_data for this user.
response = FetchToken(client, user_data).send()
user_data.set_user_creative_token_info(response)

custom = CustomEventData()
custom.set_event_name("level_complete")
custom.set_properties({
    "level": 10,
    "difficulty": "hard",
    "duration_seconds": 213,
})

response = AppEvent(client, custom, user_data).send()

CustomEventData Fields

Prop

Type

Response

200 OK:

{ "message": "Webhook Received" }