# Widget

### The most straight forward way

Copy/paste this code anywhere you want the widget to be displayed:

```markup
<script src="https://cdn.jsdelivr.net/npm/crowdmap-widget@2.1.0/dist/cm-widget.min.js">

</script>

<script> 

cmWidget.init({ 
 team: 'organizationName', // Replace by your team name
  email: 'customer@mail.com', // Not required: this is the email of the customer who make the feedback 
}); 

</script>
```

### The direct download method

**1. Download the javascript file**

Simply download the JS file by [clicking here](https://cdn.jsdelivr.net/npm/crowdmap-widget@2.1.0/dist/cm-widget.min.js).

**2. Add JS and CSS Files**

Insert the JS file on every page where you want the widget to be displayed:

```markup
<script type="text/javascript" src="path/to/js/crowdmap/cm-widget.min.js"></script>
```

**3. Initialise the widget**

```javascript
cmWidget.init({
 team: 'organizationName', // Replace by your team name
 email: 'customer@mail.com', // Not required: this is the email of the customer who make the feedback
});
```

### Options

With both methods above, you can customise the look and feel of your widget and collect further information that will be sent along with the feedback.

| Parameters         | Type    | Description                                                                                                                           | Mandatory |
| ------------------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------- | --------- |
| team               | string  | Your organisation name                                                                                                                | true      |
| email              | string  | The email or the name of the author of the feedback.                                                                                  | false     |
| tags               | array   | Array of tags                                                                                                                         | false     |
| userID             | string  | If the user is logged in, you can send the user ID of the author of the feedback                                                      | false     |
| language           | string  | 'en' for English or 'fr' for French                                                                                                   | false     |
| theme              | string  | 'dark' (default) or 'light'                                                                                                           | false     |
| positionAside      | boolean | true: the button will be fixed on the right-hand side of the screen false: the button will be fixed at the bottom right of the screen | false     |
| btnBackgroundColor | string  | '#31E6CE' (default) Background of the main button                                                                                     | false     |
| divToAppend        | string  | The class of the div where you want to append the button.                                                                             | false     |
| divToCapture       | string  | Class of the div that will be sent as a screenshot with the feedback.                                                                 | false     |


---

# 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://crowdmapsupport.gitbook.io/knowledgebase/collect-feedback/widget.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.
