Register a User
How to register a user with the Node SDK
Use RegisterUser to register a new user the first time they open the app.
This step also fetches the creative token information for the user in the same request.
import { RegisterUser } from "audiencelab_nodejs_sdk";const registerUserEvent = new RegisterUser(client, userData);
await registerUserEvent
.send()
.then((response) => {
userData.setUserCreativeTokenInfo(response);
})
.catch((error) => {
console.error("Error during user registration:", error);
});After this call:
- The user is registered with Audiencelab
- The user_data object is updated with the creative token info
If you register the user using this method, you do not need to call FetchToken separately.
Call RegisterUser once, at app install or first open.
For all future sessions, skip registration and directly send events using the existing user_data.