# 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api.beacon.li/loading-user-data-into-beaconbar.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
