Segment Performance Shortcode in WatuPRO

From version 5.9.2 WatuPRO supports a new shortcode which allows to show how a segment of the respondents performed on the test – as average percent correct answers or as average number of points.

The segment is based on the answer of a chosen question.

What does it mean and how does it work?

Let’s use an example to make things easier. We will create a single-choice question to ask the user for their age. (You can also use open-ended question for example if you want users to type their answer).

We’ll make this question a “survey” type by selecting “This is a survey question” because we don’t want it to affect the test calculations. Your situation might be different.

Then, in the final screen of the quiz we’ll add the following shortcode:

The average results of respondents aged {{{answerto-2083}}} is [watupro-segment-stats question_id=2083 criteria="percent_correct"]% correct answers on this test.

Which displayed the following output:

The average results of respondents aged 37-50 is 23% correct answers on this test.

Breaking Down The Shortcode

Let’s break down the shortcode and all its parameters so you know how to use it. If you find the explanation of the parameters complicated go straight to the examples to get a better idea how to use the shortcode.

The shortcode is watupro-segment-stats and accepts the following parameters:

question_id

This is a required parameter. The shortcode will not display anything without the question ID. You can see the question ID at the quiz Manage Questions page. It’s the first column in the table.

criteria

This is an optional parameter which defaults to “percent_correct”. You can use the following values:

  • percent_correct to display the average percent correct answers of the group answered the same way to the question in the first parameter.
  • points to display the average points collected of the group answered the same way to the question in the first parameter.
  • grade to display the percentage of users from the group who received the same grade. If you also pass the parameter grade_id you can specify the grade you are referring to – otherwise the calculation will be based on the currently achieved grade from the user.
  • category_grade to display the percentage of users in the group achieved the same category grade for the given category. When criteria=”category_grade” passing one of the parameters catgrade_id or category_id becomes required. You can for example use the shortcode once for each category grade to show the % of users achieved each specific grade on the category. If you pass category_id instead the stats will be shown based on which grade was last received by the current user on that category (see the examples for more clarity). There is a trick that makes things easy if you use the %%CATGRADES%% variable to loop through all the categories. Pass the parameter category_id like this: category_id=”this” in the “common category grade output box” on the Manage Grades page (you have to select a question category to have the box shown) and the program will automatically figure out which is the category and what grade was achieved on it for each of the categories.

compare

This attribute can be used only when criteria is “grade” or “category grade”. It lets you calculate either users who got the same grade (or category grade) as the quiz taker (this is the default behavior) or what % of users got worse or better grade.

Possible values for the attribute: “same” (default), “better” or “worse”.

segment

This is optional parameter which lets you show the results of a chosen by you segment. This is very important: by default, when the parameter is missing, the shortcode will display the results of the same segment as of the current user. So if the user responded “37-50” like in our example above, the shortcode will display the stats for all users who took the same quiz AND selected “37-50” on the question.
However the shortcode allows you to display stats for other groups by passing the segment parameter. So you can show full stats like this:
The average results of respondents aged up to 18 is [watupro-segment-stats question_id=2083 criteria="percent_correct" segment="under 18"]% correct answers on this test while the average results of respondents aged over 50 was [watupro-segment-stats question_id=2083 criteria="percent_correct" segment="over 50"]%

This shortcode is intended to be used only in the “FInal Page / Quiz Output” box. It will work just fine outside it but in this case the parameter segment becomes required and the shortcode will calculate stats based on all tests which use the question passed in “question_id” parameter.

Examples

This is a very powerful shortcode and with all these parameters it can be confusing. Some examples will make things much easier to understand:

Show average points from the group on the whole test (in the final screen):

The average points achieved from the other respondents your age is [watupro-segment-stats question_id=2083 criteria="points"].

This will display something like:

The average points achieved from the other respondents your age is 33.

***

Show average % correct answers from all groups on the whole test (in the final screen):

The average results of respondents aged up to 18 is [watupro-segment-stats question_id=2083 criteria="percent_correct" segment="under 18"]% correct answers on this test while the average results of respondents aged over 50 was [watupro-segment-stats question_id=2083 criteria="percent_correct" segment="over 50"]%

***

Show the % of users from the group who achieved the same grade (use only on the final screen):

Your grade is %%GTITLE%%.

On average [watupro-segment-stats question_id=2083 criteria="grade"]% of the respondents aged {{{answerto-2083}}} got the same grade.

This will display something like:

Your grade is B+.

On average 36% of the respondents aged18-36 got the same grade.

***

Show the % of users from the group who performed worse (got lower grade)

Your grade is %%GTITLE%%.

On average [watupro-segment-stats question_id=2083 criteria="grade" compare="worse"]% of the respondents aged {{{answerto-2083}}} performed worse than you.

This will display something like:

Your grade is B+.

On average 41% of the respondents aged18-36 performed worse than you.

***

Show the % of users from the group who achieved the same category grade in each question category:

(You need to use this shortcode inside the “Common category grade output” box and make sure %%CATGRADES%% variable is included in the “final output” of the quiz.)

For category %%CATEGORY%% you got %%POINTS%% points and %%PERCENTAGE%%% correct answers.

Grade: %%GTITLE%%

On average [watupro-segment-stats question_id=2083 criteria="category_grade" category_id="this"]% of the respondents from your age group got the same grade.

This will display something like:

For category Business Analytics you got 8 points and 65% correct answers.

Grade: Success

On average 74% of the respondents from your age group got the same grade.