Google has made it very easy to get started with Google Analytics and has millions of websites and products making use of it. This is in part due to how easy Google has made it to get started with the product. This global applicability and ease of initial setup comes as a result of Google collecting only a limited set of data and presenting only fairly generic data that is applicable to most web products. This also limits the usefulness of the data or requires intensive deep dives through the data to come to an understanding of your product.

For example, Net Promoter Score (NPS) is a key metric used by more than two thirds of Fortune 1000 companies and is a very common metric companies collect, but isn’t built into Google Analytics. I’ve use the metric in my daily work as both a metric and source of customer feedback, and have thought from time to time that it would be interesting to segment my analytics data according to user NPS score to see if any trends pop out that could lead to a suboptimal user experience. It took a little digging and a bit of work, but in the end isn’t very hard to add this data to Google Analytics.

Basic Setup

In order to track NPS, we need to setup a few custom definitions within Google Analytics. These fall into 3 main categories: metrics (data we’re going to track), dimensions (ways we want to segment our data), and calculated metrics (GA’s way of providing a metric which is based on other metrics).


For Metrics, we’re going to create 3 new metrics to track

  • NPS Rating
  • NPS Survey Count
  • NPS Value

The first one is straightforward, it’ll track the value your user submits as their NPS score. The last two are primarily there to allow us to calculate the NPS score within GA dynamically so it can apply to any date range and any sampling of data we choose to report on. Count will always be 1, and the NPS value will be either -1, 0, or 1 depending on if the user is classified as a Detractor, Passive, or Promoter.

To set these up, go to the Admin section of GA, and under your Property you’ll find an Option for Custom Definitions. Custom Metrics is under this and where we’ll set these three up at.

Example of completed Metrics

  • NPS Rating: Hit scope, Integer formatting, min/max: 0 <-> 10
  • NPS Survey Count: Hit scope, Integer formatting, min/max: 1
  • NPS Value: Hit scope, Integer formatting, min/max: -1 <-> 1


For Dimensions, there’s only 1 dimension we’re creating to segment by corresponding to whether the user is Promoter, Passive, or Detractor.

We set this up with the Custom Dimensions tool under Custom Dimensions.

  • NPS Class (User scope)

Example of completed Dimension

Calculated Metrics

If you’re looking to track your NPS score and monitor its changes over time, you can have Google Analytics calculate this value for any sample you’re looking at with a beta feature of Google Analytics called calculated Metrics. This setting is done on the View you are reporting with (rather than the property of the metrics and dimensions above), and the result will only be in the view from the point of time it is created (so this won’t calculate values on any records prior to when it was created).

  • Net Promoter Score (Integer formatting)

For calculated metrics, you need to put in the formula that defines how Google will calculate the value. This is based on the names you entered for the metrics in the earlier step.

{{Net Promoter Rating}} * 100 / {{NPS Survey Count}}

Setting up custom metric

Feed data to Google

Once the configuration is in place, it’s time to start sending your survey results over to Google Analytics where you can start reporting on it. How you send it will depend on how you’re capturing the survey results.

Using Universal Analytics (for client-side)

If you’re capturing it on a webpage that is already sending usage data to GA, it’s a simple matter of adding a new event for the survey results:

ga('send', 'event',
    'NPS Survey',    // Event Category
    'Email survey submitted', // Event Action
    'Promoter',      // Event Label
    10,              // Event value (the user selected score)
        dimension1: 'Promoter', // NPS Class: 'Promoter', 'Passive', or 'Detractor'
        metric1: 1,  // NPS Survey Count: Used to increment # of surveys
        metric2: 10, // NPS Rating: User selected NPS rating 0 - 10
        metric3: 1,  // NPS Value: 1 for promoters, 0 for passive, -1 for detractor 

Using Measurement Protocol API (for backend use)

If you’re processing the results somewhere in your backend, you’ll be needing to use the GA Measurement Protocol API. This is provided with a number of different language clients, but can be done via a simple POST to a REST endpoint such as follows:

var npsClass = 'Detractor',
    npsRating = -1,          // -1 for Detractor, 0 for Passive, 1 for Promoter
    npsValue = survey.score, // (0 - 10)
    npsCount = 1;            // always 1, used to total number of survey responses for calculated values

if (npsValue > 6) {
    npsClass = 'Passive';
    npsRating = 0;

if (npsValue > 8) {
    npsClass = 'Promoter';
    npsRating = 1;

var gaParameters = {
    v: 1,
    tid:, // Which GA property to report to, ie: UA-XXXXXXXX-X
    cid: message.cid,       // Google Analytics client id (from cookie), optional
    uid: message.uid,       // Your own client id, optional (either this or cid is required)
    nid: false,
    t: 'event',
    ds: 'ShadowAide',       // Data source (optional, can be something like web, app, call center, etc) 
    ec: 'NPS Survey',       // Event category
    ea: 'Survey Submitted', // Event action
    el: npsClass,           // Event label
    ev: message.score,      // Event value
    d1: npsClass,           // Class dimension, match the # to the dimension you created
    m1: npsCount,           // Survey count, match the # to the metric you created
    m2: npsValue,           // Value, match the # to the metric you created
    m3: npsRating           // Rating, match the # to the metric you created

restClient.postPromise('', {
    headers: {
        'Content-Type': 'application/json',
        'charset': 'utf-8'
    parameters: gaParameters

Configure reports

Once you’ve started getting your scores loaded into GA you can explore through how your user behavior differs according to their NPS ratings. The differences you find can be key to refining your marketing messages, tailoring experiences to different needs, focusing in on troublesome functionality, and generally reducing customer churn. While most of the benefit will be in segmenting your existing reports, there’s a couple NPS specific widgets I add to my projects.

NPS Dashboard

If you’re looking for an even easier solution, ShadowAide provides NPS surveys and will do most of the configuration in Google Analytics for you automatically.