Server SDKs
Client Setup
Initialize the Node.js SDK client and user data
Before sending any events, create a Client instance and prepare a UserData object.
Client
import { Client } from "@geeklab.app/audiencelab_nodejs_sdk";
const client = new Client({
apiKey: "GeekA1B2C3D4-5678-9012-abcd-ef1234567890",
baseUrl: "https://analytics.geeklab.app",
});Prop
Type
UserData
The UserData object holds device information and identity fields used across all API calls.
import { UserData } from "@geeklab.app/audiencelab_nodejs_sdk";
const userData = new UserData()
.setUserId("user_12345")
.setUserIp("203.0.113.42")
.setEventTimestamp("2026-06-09T10:00:00+00:00")
.setDeviceInfo({
device_name: "iPhone 14 Pro",
device_model: "iPhone15,2",
os: "iOS",
os_version: "17.4",
height: 852,
width: 393,
timezone: "Europe/Helsinki",
})
.setAppVersion("2.5.1")
.setIfv("6D92078A-8246-4BA4-AE5B-76104861E7DC")
.setWhitelistedProperties({
subscription_tier: "gold",
});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 probabilistic attribution matching.
Creative Token Info
After the user has been registered or fetched, pass the response to setUserCreativeTokenInfo(). The SDK stores creative token data, retention dates, cumulative totals, and merges backend-returned whitelisted properties without overwriting caller-set properties.
import { RegisterUser } from "@geeklab.app/audiencelab_nodejs_sdk";
const response = await new RegisterUser(client, userData).send();
userData.setUserCreativeTokenInfo(response);This provides the creativeToken and device context for all subsequent webhook events.
Whitelisted Properties
Whitelisted properties are durable user properties stored on the user and included during registration and app events.
userData
.setWhitelistedProperty("subscription_tier", "gold")
.setWhitelistedProperties({ region: "fi", cohort: "summer_2026" });
const currentProperties = userData.getWhitelistedProperties();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.
Session Context
If your backend can track sessions, attach session context to regular events:
const sessionId = UserData.generateSessionId();
userData.setSessionContext(sessionId);Regular app events can include session context. Dedicated session events carry session start and end details in the session payload.
SDK Version
import { SDKVersion } from "@geeklab.app/audiencelab_nodejs_sdk";
SDKVersion.getVersion(); // "2.0.0"
SDKVersion.getSDKType(); // "S2S_nodejs"
SDKVersion.getFullIdentifier(); // "S2S_nodejs-2.0.0"The SDK type is "S2S_nodejs".