The xAPI Analytics data model is detailed, so a few habits make the difference between a widget that shows the right number and one that doesn’t. This page covers those habits, two worked examples, and how to bring in your learning platform data to add context.
If you haven’t already, read What the xAPI Analytics data model contains first.
Start from the statements
Every widget you build on this model should start from the xapi_statements table. Each row is one thing a learner did, and every other table adds detail to those rows.
- Decide which actions you want to count. Answering a question, completing a module and passing an assessment are all different statements. Pick the verb first.
- Add a verb filter. Filter the widget on xapi_verbs.verb_name, for example answered or passed. Without it, your counts mix every kind of action together.
- Narrow down to the content you care about. Filter on the course, module or activity name before you add anything else. This keeps widgets fast and the numbers easy to check.
- Then add the detail. Bring in fields from the other tables, such as the question text, the answer options or the learner’s location.
Best practices
- Count learners, not rows. One learner can send several statements for the same question, for example by retaking an assessment. To count people, use a distinct count of persona_id (Sisense’s Count, not Count All).
- Decide which attempts you want. Use the registration field to separate attempts, then choose whether to report on every attempt, the first or the latest.
- Use timestamp for dates. Timestamp is when the learner did the action. Stored is when the record arrived and can be later.
- Use names, not IDs. Activity IDs look like web addresses and are hard to read. Filter and label with course, module and activity names instead.
- Put questions in order with activity number. Sort question-level widgets by activity_number so questions appear in the order learners saw them.
- Pick the right score field. scaled_score is the easiest to compare, as it works like a percentage (0.8 = 80%). raw_score is the score as the content reported it, out of max_score.
- Expect gaps. Not all content sends the same detail. If a field is empty, check that the content sends it before assuming something is wrong.
- Show how up to date the data is. The data isn’t live. Add last_refresh_date from the data_model_stats table to your dashboard so viewers know when it was last refreshed. If recent activity seems to be missing, compare it with latest_updated_at, the time the newest statement arrived.
Using xAPI data with your learning platform data
xAPI statements tell you what happened inside the content. The learning platform (LXP) tables in this model tell you where it sits and who the learner is. Using them together lets you filter and group xAPI results the same way you would in your other reports.
| To add… | Use | Linked from the statement by |
| Course, module, item or resource names | lxp_courses, lxp_levels, lxp_objects, lxp_resources | lxp_course_id, lxp_level_id, lxp_object_id, lxp_resource_id |
| Learner details such as name, email, location, function or seniority | lxp_users | The learner (persona) |
| Job positions and groups | positions, groups | The learner’s LXP profile |
| Badges | lxp_award_class | lxp_award_class_id |
Things to bear in mind:
- Use LXP fields for names and filters, and xAPI fields for what happened. For example, filter on lxp_courses.course_name, then count xAPI statements.
- LXP details are the most reliable way to identify learners. Actor email in the xAPI tables can be blank, depending on how your platform sends xAPI data.
- Some statements don’t link to the LXP. Content hosted outside your learning platform can send statements with no LXP course or user. These rows show as blank when you group by an LXP field.
Example 1: Answer breakdown for a question
Show one question, all its possible answers, and how many learners chose each, including answers nobody chose.
- Widget: Column chart or Pivot
- Filters: verb_name = answered; course_name = your course; activity_name = your question
- Categories (or Rows): component_description from xapi_interaction_components (All)
- Values: a distinct count of persona_id
- Optional: colour by correct to highlight the right answer
Because the (All) table lists every possible answer, options nobody chose still appear with a count of 0.
Example 2: Pass rate and average score by location
Compare assessment results across locations by combining xAPI results with LXP user details.
- Widget: Pivot
- Filters: verb_name = passed or failed; course_name = your assessment’s course
- Rows: user_location from lxp_users
- Values:
- Learners: distinct count of persona_id
- Pass rate: a formula dividing learners where success is true by all learners
- Average score: the average of scaled_score, shown as a percentage
For how to build the pass rate formula, see Formulas, including percentages.
Next steps
- What the xAPI Analytics data model contains
- xAPI data model: data dictionary
- How widgets count and aggregate
- Formulas, including percentages