# NPS widget

![Net Promoter Score Widget](/files/x1UmzPi7FIshYOJL0o5T)

![Net Promoter Score Widget](/files/cZDvVsDosi5Lg2j4ck5a)

1. Install the widget SDK by following the steps described here:

{% content-ref url="/pages/-MkT-mqpZEgkRg32PTEn" %}
[Installing widgets](/widgets/installing-widgets.md)
{% endcontent-ref %}

After installing the SDK code you need to call the NPS Init function:

```javascript
<script>
    ProdCamp('initNPSwidget', {email: "name@domain.com"});
</script>
```

## NPS widget commands

There are several commands that you can use to manipulate the feedback widget behavior

* **initNPSWidget** - this one you already know and it instantiates an NPS widget.
* **openNPSWidget** - this command can be used to open the widget manually from anywhere in your code\
  To test the NPS widget manually, you can either call the following command in the browser's console

```javascript
ProdCamp('OpenNPSWidget')
```

or add a button to your page:

```html
<button onclick="ProdCamp('openNPSWidget')">TEST NPS</button>
```

* **closeNPSWidget** - this command will close the widget
* **updateNPSWidgetUser** - using this command you can update the user's email which will be used to determine when the widget should appear
* **destroyNPSWidget** - destroy the widget instance on the page


---

# 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://help.prodcamp.com/widgets/nps-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.
