Beacon API Docs
  • Beacon - Installation
  • Beacon - Usage
    • Beacon Usage - Overview
    • Usage in a Next.js Environment
    • Open and Close Programmatically
  • Native Routing in Beacon
    • Vanilla JS - Native Routing Example
    • React JS - Native Routing Example
    • Vue JS - Native Routing Example
    • Angular JS - Native Routing Example
  • Loading User Data into BeaconBar
  • Loading Session Data into Beacon Bar
  • Callbacks in Beacon
    • Add Callbacks in Beacon
    • Remove Callbacks in Beacon
    • React Example for Callbacks
  • Trigger smart journeys From Your App
  • Execute Command From Your App
  • Open Help Docs From Your App
  • Emitting Events to Beacon
  • Listening to events from Beacon Bar
    • Adding event listeners in Beacon
    • Removing event listeners in Beacon
    • React Example for Event Listeners in Beacon
  • List of events emitted by Beacon Bar
  • Implementing Content Security Policy (CSP) for Beacon Integration
Powered by GitBook
On this page

Loading User Data into BeaconBar

To enhance the user experience and provide personalized support or interactions, you can load user data into beacon using the @beacon.li/bar package. This allows you to pass relevant user information to these components.

Loading User Data into BeaconBar

To load user data into BeaconBar, you can use the Beacon.loadUser method. This method takes two parameters:

  1. userId (string): The unique identifier of the user, which can be an email address or a database ID or any other uniquely generated ID to map to that user.

  2. metaData (object): An object containing user data to be passed to the Beacon Bar.

Here's how to use it:

import {Beacon} from '@beacon.li/bar';
Beacon.loadUser(userId, {
    name: 'John Doe',
    isPremiumUser: true,
    currentPlan: 'Premium'
});

In the example above, we're loading user data for a user with the provided userId. The metaData object contains user-specific information such as the user's name, premium status, and current subscription plan. This data can be used to personalize the user experience or gather relevant context about the user.

Benefits of Loading User Data

Loading user data into beacon allows you to:

  1. Personalize the support experience by addressing users by name.

  2. Configure rules to show/hide commands based on user meta data.

  3. Gather context about users, such as their subscription status or preferences.

  4. Provide more relevant and tailored responses during interactions.

  5. Improve user engagement and satisfaction.

PreviousAngular JS - Native Routing ExampleNextLoading Session Data into Beacon Bar

Last updated 1 year ago