SdkReact sdk
API Reference
Audiencelab React SDK API reference
API Reference
initializeAudiencelab(apiKey: string): Promise<{ token: string, metrics: any }>
Initializes the Audiencelab SDK with your API key.
| Parameter | Type | Description |
|---|---|---|
apiKey | string | Your API key for the Geeklab Audiencelab service |
Returns a Promise that resolves to an object containing:
token: the generated session tokenmetrics: initial metrics data
sendCustomPurchaseEvent(id: string, name: string, value: number, currency: string, status: string): Promise<any>
Sends a custom purchase event.
| Parameter | Type | Description |
|---|---|---|
id | string | The ID of the purchased item |
name | string | The name of the purchased item |
value | number | The value of the purchase |
currency | string | The currency code (e.g., "USD") |
status | string | The status of the purchase ("completed", "failed") |
Returns a Promise that resolves when the event is sent.
sendCustomAdEvent(adId: string, name: string, source: string, watchTime: number, reward: boolean, mediaSource: string, channel: string, value: number, currency: string): Promise<any>
Sends a custom ad event.
| Parameter | Type | Description |
|---|---|---|
adId | string | The ID of the ad |
name | string | The name of the ad |
source | string | The source of the ad |
watchTime | number | Watch time in seconds |
reward | boolean | Whether the ad was rewarded |
mediaSource | string | The media source (e.g., "admob") |
channel | string | The channel (e.g., "paid") |
value | number | Value associated with the ad |
currency | string | Currency code (e.g., "USD") |
Returns a Promise that resolves when the event is sent.