> For the complete documentation index, see [llms.txt](https://help.prodcamp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.prodcamp.com/widgets/nps-widget.md).

# 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
