End-User Identification

Identifying end-users allows developers to associate actions performed in the builder with specific end-users in the host application. This is essential for personalizing the experience, tracking saved blocks, and managing uploads that belong to individual end-users.

Why Identify End-Users?

Identifying end-users allows the builder to:

  • Save and load personalized content: Each end-user can have their own set of saved blocks, or file uploads.
  • Provide a seamless experience: Ensure that the right content is available to the right end-user.
  • Improve tracking: Keep track of who created, edited, or saved specific files for audit or reporting purposes.

Setting Up End-User Identification

Developers need to provide the builder with information about the current end-user when initializing the builder. This is done by passing the user details through the user property during the initialization process.

Here’s an example of how to initialize the builder with the end-user information:

unlayer.init({
  user: {
    id: 1,
    name: 'John Doe',
    email: '[email protected]'
  }
})

User Object Properties

  • id (required): This is the unique identifier for the end-user within your host application. It could be a number or a string.
  • name (optional): The name of the end-user, which can be displayed in the interface or logs.
  • email (optional): The email address of the end-user.

Why the id is Required

The id is the key property that helps the builder associate the user’s actions and saved content with their account. Without it, the builder won’t know which content belongs to which user, making it impossible to offer certain features.


Use Cases for End-User Identification

  • Saved Blocks: When users save blocks, they are saved under a unique id, making them available only to that specific end-user. The id helps ensure only the right person has access to their saved content. Learn More
  • User Uploads: When users upload images or files, they are saved under a unique id, making them available only to that specific end-user. These files are visible to the end-user in uploads tab. Learn More

Best Practices

  • Unique and Consistent IDs: Ensure that the id you pass is always unique and consistent for each user across different sessions.
  • Optional Fields: While fields like name and email are optional, it’s good practice to pass them to personalize the end-user experience.
  • Security: Make sure you review the Security Settings to setup identity verification. Identity verification prevents third parties from impersonating your logged-in users.