DEV Community

JustOneCX
JustOneCX

Posted on Originally published at justonecx.com

How to add an NPS survey to your web app

You add an NPS survey in the Surveys section of the JustOneCX dashboard. Pick the NPS type, write the question, choose where and when it appears, set how often it repeats, choose who sees it and publish. Answers show up on the survey's Results tab.

NPS stands for Net Promoter Score. It asks one question: how likely are you to recommend this product, on a scale from 0 to 10? The scale and the idea are general knowledge about the method. This guide covers the steps in the builder.

What do you need before you start?

You need the SDK installed on your site. The quickstart shows the one-line connect. If you want to show the survey only to certain people, send identify() calls so the survey can read traits like plan and role. See identify, group, track.

A survey that shows on page load or after scrolling is set up in the builder. You add code only when you trigger the survey from an event.

How do you create the survey?

Follow these steps from the surveys guide.

  1. Open Surveys in the dashboard.
  2. Pick a type and write the question. For this guide, pick NPS.
  3. Choose where it appears: slide-out, modal or banner.
  4. Choose when it appears: on page load, after scrolling, or when your code sends a specific event.
  5. Set repeat frequency.
  6. On the Settings tab, choose who sees it, then publish.
  7. Read the answers on the Results tab.

Each step is short. The sections below explain the choices.

Which type and question should you choose?

Surveys support NPS, CSAT, CES and written feedback. You can also use the block builder for custom layouts with choice, rating and NPS blocks. For a plain NPS, choose the NPS type and keep the standard wording about recommending the product.

If you are not sure which type fits, read NPS vs CSAT vs CES. One thing to know up front: a survey type cannot change after its first response. Choose before you publish.

Where should the survey appear?

You can show it as a slide-out, a modal or a banner. A slide-out or banner interrupts less than a modal. That is general design advice, not a product rule. Pick the one that matches how much attention the question deserves.

When should it appear?

You have three triggers.

  • Page load. The survey shows when a matching page opens.
  • Scroll. The survey shows after the visitor scrolls.
  • Event. The survey shows when your code sends an event.

An event trigger is the most precise. Set the trigger to event and enter an event name. Then call:

import { track } from "@justonecx/sdk";

track("completed_onboarding");
Enter fullscreen mode Exit fullscreen mode

The next track() call with that exact name shows the survey once. Read more in in-app survey trigger events.

How often should it repeat?

Set the repeat frequency in step 5. By default a person sees a survey once, or again after a throttle period. Do not ask too often. See in-app survey best practices for ideas on timing and frequency.

If you want to ask after every order, ticket or purchase, use Show once per (event property) in the Delivery panel instead. It works with event triggers only. The Frequency setting and the throttle do not apply to a survey that uses it.

Who should see it?

Open the Settings tab. Surveys use the same targeting editor as tours and announcements. You can set:

  • Who sees it. Pick segments and add conditions. You can also target new or returning visitors.
  • Which pages. Add "show on" and "hide on" rules. Rules can be exact, prefix, wildcard or regex.

A survey with page rules only opens when the visitor is on a matching page. An event trigger that fires on another page waits, and the survey shows when the person reaches a matching page.

The server applies the audience before content is sent, so people outside the audience never receive the survey. Details are in the targeting guide. Leaving a part empty means no restriction. With no segments and no page rules, everyone sees it, everywhere.

How do you test it before you publish?

Use the Test survey mode in the builder. It lets you see the survey without saving a response. Test your page rules and trigger here, so your first real responses are not wasted on a broken setup.

How do you read the results?

Responses appear under the survey on the Results tab. To work with the raw data, choose Download responses (CSV). The file has one row per response with the answers, score, person and time.

You can also show different follow-up questions by score band, for example one prompt for detractors and another for promoters. NPS groups scores into detractors, promoters and passives. That grouping is part of the general NPS method.

Frequently asked questions

Can I trigger an NPS survey from my code?

Yes. Set the trigger to event, enter an event name, and call track() with that exact name. The next matching call shows the survey once.

Can I change the survey type later?

Not after the first response. A survey type cannot change once someone has answered, so pick the type before you publish.

Can I export the answers?

Yes. Open the Results tab and choose Download responses (CSV). The file has one row per response.

Can I try the survey without saving a response?

Yes. Use the Test survey mode in the builder to see it without saving a response.

See how it works in the live demo.

Top comments (0)