Net Promoter Score (NPS) Example Code

Orb
Photo by Jjjohn

I first ran across the Net Promoter Score through a post by Eric Ries and it seems like a simple but effective measure of how happy your customers are. Its beauty is how basic it is, which both makes it easy to interpret and straight-forward to gather without annoying your customers.

Unfortunately there don't seem to be any off-the-shelf solutions to help gather the information. In the past I've created surveys through companies like SurveyMonkey, but that's both a pretty intrusive experience and they don't give you any way to calculate an NPS without downloading the raw data into Excel and doing it yourself!

What I wanted was a way to survey my customers from within the site, without sending them to an external page or another window, store the results on my own server and then have a simple way of viewing reports on the data over time. Since there was nothing else out there, I wrote a simple Javascript/PHP/MySQL module to handle these requirements, and since I'm sure there are other people who could use something similar and I hate seeing wheel-reinvention, I've released it under a BSD license.

It works by randomly bringing up an in-page popup, asking the user whether they'd recommend the service to a friend, and then requesting any other comments. The data gets passed back to the server and stored in the database, where you can then get a very basic HTML report, or pull the data as JSON to pass into your metrics pipeline, for things like daily email reports.

You can download the code here:
http://code.google.com/p/npspopup/

If you want to try in action, here's the demo page:
http://web.mailana.com/labs/npspopup/index.php

I'm testing it on my own site but the code is still pretty pre-alpha, so don't be shy with bug-fixes and other modifications.

One response

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: