# Pre-fill name and email address

{% hint style="info" %}
In certain sites, you as the website owner would already have access to the user's information such as name and email address. With this guide, you can speed up the reporting process by pre-filling the name and email address fields in the report page.
{% endhint %}

## 1. Wait for the button to load

There are many ways to check if an element has loaded, but the easiest way to do so would be to check for our global variable `isUserHelpReady`. Below is an example of how you can do so with Javascript:

```javascript
if(window.isUserHelpReady == true) {
    //get your user data here
}
```

## 2. Send the user data to the button

After checking to see if the button has loaded, you can then the user data by running these two global functions through the `window` interface:

| Function                      | Definition                                          |
| ----------------------------- | --------------------------------------------------- |
| window\.UserHelpSetName(name) | Pre-fill the name field with the parameter `name`   |
| window\.UserHelpSetName(name) | Pre-fill the email field with the parameter `email` |

Below is an example using Javascript:

```javascript
if(window.isUserHelpReady == true) {
    const userData = {
        name:"Bob",
        email:"bob@example.com"
    }
    
    window.UserHelpSetName(userData.name)
    window.UserHelpSetEmail(userData.email)
}
```


---

# 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://docs.userhelp.co/advanced-usage/pre-fill-name-and-email-address.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.
