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("2025-03-11T10:15:00.000Z")
.setDeviceInfo({
device_name: "iPhone 14 Pro",
device_model: "iPhone15,2",
os: "iOS",
os_version: "17.4",
height: 852,
width: 393,
timezone: "Europe/Helsinki",
});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 and assigned a token, set the token info:
userData.setUserCreativeTokenInfo({
creative_token: "abc123-creative-token",
os_system: "iOS 17.4",
device_name: "iPhone 14 Pro",
device_model: "iPhone15,2",
utc_offset: "+03:00",
});This provides the creativeToken and device context for all subsequent webhook events.
SDK Version
import { SDKVersion } from "@geeklab.app/audiencelab_nodejs_sdk";
SDKVersion.getVersion(); // "1.1.0"
SDKVersion.getSDKType(); // "S2S_nodejs"The SDK type is "S2S_nodejs", sent as sdk_type in all requests.