Server SDKs

Custom Event

Send custom events with the Node.js SDK

Use custom events for gameplay, subscription, onboarding, or other milestones that do not fit the purchase, ad, or session event models. This example assumes the user has already been registered with Audiencelab.

Usage

import {
	Client,
	CustomEventData,
	AppEvent,
} from '@geeklab.app/audiencelab_nodejs_sdk';

const client = new Client({
	apiKey: 'YOUR_API_KEY',
	baseUrl: 'https://analytics.geeklab.app',
});

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,
	'user_12345',
	'custom-level-5-complete-user123',
).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, 'user_12345', 'evt_level_complete_5', {
	email_sha256: 'hashed-email',
}).send();