With Autoprompt, you can actively engage users by automatically popping up the NPS® widget. The widget will popup for a user once every sixty days.
To enable Autoprompt, you will need to edit the Widget script that resides in your web site/application, and enable Autoprompt from within the Admin Console.
- In your widget script, Identify the user (the script must run after the SDK has loaded). To ensure that users don’t get autoprompted too often, Autoprompt will only work if you have identified the user with an email or email and ID using the identify method.
- Add the Autoprompt script. It must be added after the SDK, and below the Identify script. When this method is called, it verifies that the identified user should be prompted at this time, and then prompts the user for a NPS®.
// UserVoice Autoprompt for NPS
- Enable Autopromp in the Admin Console:
- Navigate to Settings → Widgets → Scroll down to Advanced setup → Autoprompts → Click Edit.
- Check the box and click Save.
If you’ve added the default trigger to your page, Autoprompt will appear as a popover targeted to that trigger. If there is no default trigger, then Autoprompt will appear as a toast since they do not have a default object to anchor themselves to. However, you can specify your own target HTML element:
// UserVoice Autoprompt for NPS with custom trigger
Alternatively, you can specify a particular HTML element the autoprompt will target as a popover by adding the
data-uv-autoprompt attribute to the element:
<span id="custom_target" data-uv-autoprompt>Custom target</span>
Note: If multiple
data-uv-autoprompt attributes are found on the page, the last one will be used.
If you use ajax to update your website rather than page loads, you can call the autoprompt method multiple times. Each time it is called, it checks if there are any new server-side prompts to display. If a new one is found, it will be displayed to the user.
Some examples include prompting after a simple ajax login, prompting after the user scrolls to the bottom of the page, or waiting 10 seconds after the page loads to prompt them.