Server SDKs
Custom Event
Send custom events with the Node.js SDK
Use custom events for gameplay, subscription, onboarding, or backend milestones that do not fit the purchase, ad, retention, or session event models.
Usage
import {
Client,
UserData,
CustomEventData,
AppEvent,
} from '@geeklab.app/audiencelab_nodejs_sdk';
const client = new Client({
apiKey: 'YOUR_API_KEY',
baseUrl: 'https://analytics.geeklab.app',
});
const userData = new UserData()
.setUserId('user_12345')
.setUserIp('203.0.113.42')
.setUserCreativeTokenInfo({
creativeToken: 'abc123-creative-token',
os_system: 'iOS 17.4',
device_name: 'iPhone 14 Pro',
device_model: 'iPhone15,2',
utc_offset: '+03:00',
install_date: '2026-06-09T10:00:00+00:00',
last_login_date: '2026-06-10T10:00:00+00:00',
});
const custom = new CustomEventData()
.setEventName('level_complete')
.setProperties({
level: 5,
score: 12000,
time_seconds: 94,
completed_at: new Date('2026-06-10T10:15:00Z'),
})
.setDedupeKey('level-5-complete-user123');
const response = await new AppEvent(client, custom, userData).send();CustomEventData Fields
Prop
Type
Property values are normalized before sending. Dates become ISO strings, nested objects and arrays are normalized recursively, sets become arrays, and unsupported scalar values are stringified.
Per-Event Blacklisted Properties
Pass blacklisted properties to AppEvent when a specific event needs to forward sensitive values. They are not stored on UserData or reused by later events.
await new AppEvent(client, custom, userData, 'evt_level_complete_5', {
email_sha256: 'hashed-email',
}).send();