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.

ParameterTypeDescription
apiKeystringYour API key for the Geeklab Audiencelab service

Returns a Promise that resolves to an object containing:

  • token: the generated session token
  • metrics: initial metrics data

sendCustomPurchaseEvent(id: string, name: string, value: number, currency: string, status: string): Promise<any>

Sends a custom purchase event.

ParameterTypeDescription
idstringThe ID of the purchased item
namestringThe name of the purchased item
valuenumberThe value of the purchase
currencystringThe currency code (e.g., "USD")
statusstringThe 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.

ParameterTypeDescription
adIdstringThe ID of the ad
namestringThe name of the ad
sourcestringThe source of the ad
watchTimenumberWatch time in seconds
rewardbooleanWhether the ad was rewarded
mediaSourcestringThe media source (e.g., "admob")
channelstringThe channel (e.g., "paid")
valuenumberValue associated with the ad
currencystringCurrency code (e.g., "USD")

Returns a Promise that resolves when the event is sent.