Server SDKs

Register User

Register a user and trigger attribution matching

The RegisterUser API sends the S2S registration envelope to /v2/fetch-token, triggering attribution matching, storing the server-side user state, and returning a creative token.

Usage

from audiencelab_python_sdk import (
    Client, UserData, RegisterUser
)

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")
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_ifv("6D92078A-8246-4BA4-AE5B-76104861E7DC")
user_data.set_whitelisted_properties({
    "campaign": "summer_2026",
    "ab_group": "variant_b",
})

response = RegisterUser(client, user_data).send()

Response

{
  "creative_token": "abc123-creative-token",
  "install_date": "2026-06-09T10:00:00.000Z",
  "last_login_date": "2026-06-09T10:00:00.000Z",
  "retention_day": 0,
  "backfill_day": 0,
  "total_purchase_value": 0,
  "total_ad_value": 0,
  "wp": { "_network": "meta" }
}

Persist the Token

Call user_data.set_user_creative_token_info(response) after registration. The SDK stores the returned creative_token, retention state, cumulative values, and merges the returned wp object for subsequent webhook calls without overwriting caller-set properties.

Whitelisted Properties

Customer-set wp keys must not start with _; those keys are reserved for backend-returned properties such as attribution metadata. Use blacklisted properties only on individual AppEvent calls when sensitive values need to be sent as bp.

After Registration

Set the creative token info for subsequent calls:

user_data.set_user_creative_token_info(response)