Forums/Documentation/Reporting and performance

Displaying your last 100 satisfaction ratings

Jake Holman
posted this on September 28, 2011 17:03

Displaying your last 100 customer satisfaction ratings is more advanced to set up than using the ratings box widget to display totals.

Zendesk provides your satisfaction ratings in JSON format. It looks something like this, where 1 is a positive rating, 0 is a negative rating:
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1,  ...]
As you can see, it is very basic. It's up to you to decide how to display the data.

You must be an administrator to use this feature.

Accessing your last 100 ratings

You need to turn on satisfaction ratings, if you haven't already done so. Then you can access your last 100 satisfaction ratings.

To turn on satisfaction ratings and access your ratings
  1. Click the Admin icon () in the sidebar, then select Settings > Customers.
    Zendesk Classic: Select Settings > End-users.
  2. Click the Satisfaction tab.
  3. Make sure that Allow customers to rate ticketsis selected and that you have at least 100 ratings.

    If you don't have at least 100 ratings, you'll see the following message.

  4. Select Allow me to display public satisfaction statistics.
  5. Click Save Tab.

    The page updates with more information, including statistics based on your last 100 customer satisfaction ratings.

  6. Go to http://subdomain.zendesk.com/satisfaction.json (where subdomain is your Zendesk account) to access the JSON file with your ratings.

Displaying your last 100 ratings

The easiest way to display your ratings on a page is to use images to represent responses.

In this example, a happy Buddha face represents a positive rating, and an unhappy Buddha face represents a negative rating.

Here is the jQuery for this example (you can use any framework or language you'd like):

<div id="last_100_ratings"></div>
<script type="text/javascript">
$.ajax({
  url: "https://support.zendesk.com/satisfaction.json",
  dataType: "jsonp",
  cache: false,
  success:function(data){
    elem = $("#last_100_ratings"); // Change where you want the ratings rendered
    for (i=0;i<data.length;i++) {
      if (data[i] == 1) {
        elem.append('<div class="satisfaction_good"><img src="https://assets.zendesk.com/images/satisfaction/happy_buddhy.png?131..."/></div>')
      } else {
        elem.append('<div class="satisfaction_bad"><img src="https://assets.zendesk.com/images/satisfaction/sad_buddhy.png?13171..."/></div>')
      }
    }
  }
});
</script>

This code snippet gets your last 100 ratings from Zendesk, then iterates through the entire length of the response (which will always be 100) and puts a smiley or sad face in the #last_100_ratings element.

Other options for using this data include:
  • Add this data to a graph using jCharts or a similar program.
  • Collect and store your ratings data daily so you can review historical data.
  • Generate an image from it to use in email newsletters or signatures.
 

Comments

User photo
Sammy Awad

This is a great idea achieved in a very simple format. Like it.

October 04, 2011 09:47
User photo
Adam
computeroverhauls

Hi Jake,

 

    I was able to get the first part working which displays the rating in the boxes but I haven't been able to get the smiling faces to show up. I've only use java script very lightly so I'm sure I'm just missing something and perhaps you can point me in the right direct. 

I tried just pasting the java code snippet into a HTML document but that doesn't seem to do it.  Is there something else I need to do to get the faces to display?

 

Thanks

October 05, 2011 07:33
User photo
Jake Holman
Product Manager

Hey Adam, do note that displaying the past 100 ratings in the format we've shown is intended to be for advanced users with knowledge of JavaScript. So if you're pretty unfamiliar with it I really would recommend getting a JavaScript friend to help out.

In the example we show, we're using jQuery to keep it simple. You'll need to include the JavaScript library included on your page in order to use the exact example.

October 05, 2011 12:02
User photo
Omar Madrid
Project C Beta Testers

Hi,

I want to insert in our website the overall satisfaction

percentage of satisfied%

Any sugestion how to do this?

Thanks

OM

February 05, 2012 06:50
User photo
Alan Earle

Hi,

Can this be added to my zendesk forums? Or only it can be added to my website?

The thing is that I want to add it to my zendesk, mangacorta.zendesk.com so when people enter they can see it. I don´t want it on my website.

Thanks

July 30, 2013 09:46
User photo
Adam L.
Zendesk

@Omar - The widget should already include this - I believe you can even just delete the numbers and leave the score, if desired!

 

@Alan - Do you want it as a widget in the forums, or a forum article itself?  If in a forum article, you'd need Javascript/HTML support enabled, and then you'd just paste the code in the HTML of the article.  If in a widget, you'd just need to add it to a custom widget (which support HTML)!

 

August 01, 2013 15:33