Client Setup
How to initialize the React SDK client and user data
Before sending any events, you need to create a Audiencelab instance with your API key
import { initializeAudiencelab } from "@geeklab.app/audiencelab-react-web-sdk";
const apiKey = "YOUR_API_KEY_HERE";
initializeAudiencelab(apiKey)
.then(({ token, metrics }) => {
console.log("SDK initialized successfully:", token, metrics);
})
.catch((error) => {
console.error("Failed to initialize SDK:", error);
});
When the SDK is initialized, it automatically measures user retention events.
Important
Call this only once, during app startup (e.g., in your main App component or a provider)
The SDK handles these calculations in the background, and shares anonymous usage data attributed to the correct creative.