#
createDefaultUserTraits
Creates an object containing the default user traits used to identify a user in a Workleap web application.
#
Reference
const traits = createDefaultUserTraits(identification)
#
Parameters
identification
: An object that uniquely identifies the current user and provide additional context about the user environment.userId
: A value that uniquely identifies the current user.organizationId
: The organization's unique id.organizationName
: The organization name.isMigratedToWorkleap
: Whether or not this user's organization has been migrated to use the WLP, or if the user has signed up to the new experience directly.isAdmin
: Whether or not the user is an administrator in the current workspace.isOrganizationCreator
: An optional value indicating whether or not the user originally signed up to create the workspace.isReportingManager
: An optional value indicating whether or not the user is a reporting manager in the current workspace.isTeamManager
: An optional value indicating whether or not the user is a team manager in the current workspace.isExecutive
: An optional object includingboolean
values indicating whether or not the user is an executive for specific product:wov
: An optional value indicating whether or not the user is an Officevibe executive.lms
: An optional value indicating whether or not the user is an LMS executive.onb
: An optional value indicating whether or not the user is an Onboarding executive.sks
: An optional value indicating whether or not the user is a Skills executive.wpm
: An optional value indicating whether or not the user is a Performance executive.pbd
: An optional value indicating whether or not the user is a Pingboard executive.
isCollaborator
: An optional object includingboolean
values indicating whether or not the user is a collaborator for specific product:wov
: An optional value indicating whether or not the user is an Officevibe collaborator.lms
: An optional value indicating whether or not the user is an LMS collaborator.onb
: An optional value indicating whether or not the user is an Onboarding collaborator.sks
: An optional value indicating whether or not the user is a Skills collaborator.wpm
: An optional value indicating whether or not the user is a Performance collaborator.pbd
: An optional value indicating whether or not the user is a Pingboard collaborator.
planCode
: An optional object includingstring
values indicating the user plan code for specific product:wov
: An optional value indicating the user plan code for Officevibe.lms
: An optional value indicating the user plan code for LMS.onb
: An optional value indicating the user plan code for Onboarding.sks
: An optional value indicating the user plan code for Skills.wpm
: An optional value indicating the user plan code for Performance.pbd
: An optional value indicating the user plan code for Pingboard.
#
Returns
An object including the default user traits matching the provided identification values:
#
Usage
#
Get default traits
import { createDefaultUserTraits } from "@workleap/logrocket";
import LogRocket from "logrocket";
const traits = createDefaultUserTraits({
userId: "6a5e6b06-0cac-44ee-8d2b-00b9419e7da9",
organizationId: "e6bb30f8-0a00-4928-8943-1630895a3f14",
organizationName: "Acme",
isMigratedToWorkleap: true,
isOrganizationCreator: false,
isAdmin: false
});
Logrocket.identify(allTraits.userId, allTraits);
#
Send additional traits
You can send custom user traits to improve filtering in LogRocket. To do so, merge the default user traits with your additional traits before sending them:
import { createDefaultUserTraits } from "@workleap/logrocket";
import LogRocket from "logrocket";
const allTraits = {
...createDefaultUserTraits({
userId: "6a5e6b06-0cac-44ee-8d2b-00b9419e7da9",
organizationId: "e6bb30f8-0a00-4928-8943-1630895a3f14",
organizationName: "Acme",
isMigratedToWorkleap: true,
isOrganizationCreator: false,
isAdmin: false
}),
"Additional Trait": "Trait Value"
};
Logrocket.identify(allTraits.userId, allTraits);
Additional user trait names should align with Mixpanel property conventions. We recommend using human-readable names and appending a - {ProductName}
suffix for product-specific traits, for example: Plan Code - Officevibe
.