The post below contains a short survey that anybody can take; the results are then imported into Displayr and plotted. The resulting charts are embedded back into the blog post to demonstrate how Displayr can be used in conjunction with JotForm.
Let's start by creating a customer feedback survey. If you don't have a JotForm account, click here to sign up for free. Building a form should be quite intuitive, but if you run into any problems there is plenty of help available.
When you're happy with your form, click PUBLISH on the JotForm site. Once you've done that, there are various options for how respondents can fill out the form. You can send them a link like this, or embed it in a blog post or website.
Below are two embedding options. You could also use scripts, pop-ups, buttons or third-party platforms such as content management systems. Please fill out the form for yourself!
JotForm embedded with an iframe
JotForm embedded in a Lightbox
Importing the responses to Displayr
To get started, you only need two things: an API key and a Report ID Number.
An API key is required to automatically extract data from JotForm, and this link describes how to do that in a few simple steps. To find the Report ID Number, follow JotForm's guide on "How to create a report" and make a note of the resulting number.
Once you have your API key and ID number, you're ready to analyze your data in Displayr. Add a new data set by clicking on the blue cloud New Data Set button or the plus symbol (+) in the data tree on the bottom left. Choose R as the source of data and paste in the following code, replacing YOUR_API_KEY and YOUR_REPORT_ID with your values.
message("R output expires in 600 seconds") library(jsonlite) jotform.api.key = "YOUR_API_KEY" report.id = "YOUR_REPORT_ID" url = paste0("https://api.jotform.com/report/", report.id, "?apiKey=", jotform.api.key) json = fromJSON(url) report = read.csv(json$content$url)
By clicking this link, you can access a Displayr template document and insert your own API key and Report ID into the data set code. The template document contains static demo data, but feel free to connect it up to your own survey responses.
Visualizing the Responses
The data consists of IP addresses and timestamps, as well as responses to the scale and text survey questions. You can experiment with the best ways to present your data.
The first line of the R code above updates the Displayr document with the latest responses every 10 minutes. To see the latest document, click here. Because the charts embedded in this post are cached, they will be updated daily.
Below is a histogram of the rating responses.
The following chart displays the average rating by submission date.
Maps and Word Clouds
The IP addresses collected can be used to identify the location of the respondents. With that information, we can easily plot a map showing which countries our responses came from. To read more about geocoding IPs, see this post
Finally, we can collate the free-form text data into a word cloud to highlight popular terms.
Try it yourself
This post has demonstrated the "full circle" of importing and exporting JotForm survey data to and from Displayr. To create your own document and chart the results of a survey using our template, click here.