Client-SideReact SDKUsage

Custom Events

Track any custom event from the app

Use sendCustomEvent to send a custom event when a user performs any action in your app.

import { sendCustomEvent } from "@geeklab.app/audiencelab-react-web-sdk";
sendCustomEvent(
  "level_complete", // eventName
  {
    value: "100", // value
    id: "level_5", // id (optional)
    key: "difficulty:hard" // key (optional, max 2 key-value pairs)
  }
)
  .then((response) => {
    console.log("Custom event sent successfully:", response);
  })
  .catch((error) => {
    console.error("Failed to send custom event:", error);
  });

Data types for the request are:

Prop

Type

params Object should be as follows.

Prop

Type

Custom events allow tracking of any user action or game event that doesn't fit into the standard purchase or ad event categories.