Identity
Set identity
Identify users on login so you can track them across sessions and match survey responses to real users.
Requirements:
- The unique visitor id must be between 1 and 255 characters.
On module init
ScreebModule.forRoot({
autoInit: true,
websiteId: "<YOUR-CHANNEL-ID>",
userId: "<USER-ID>",
userProperties: {
firstname: "<user-firstname>",
plan: "<user-plan>",
last_seen_at: new Date(),
authenticated: true,
},
})
After init
import { ScreebModule, ScreebService } from "@screeb/sdk-angular";
constructor(private screeb: ScreebService) {}
// Set identity
await this.screeb.identity("<USER-ID>");
// With properties
await this.screeb.identity("<USER-ID>", {
email: "support@screeb.app",
plan: "growth-monthly",
});
Reset identity (logout)
await this.screeb.identityReset();
Update properties
await this.screeb.identityProperties({
email: "support@screeb.app",
age: 42,
logged: true,
signed_up_at: new Date(),
});
// Delete a property by setting it to null
await this.screeb.identityProperties({ company: null });
Get current identity
const identity = await this.screeb.identityGet();