ANALYTICS / PANEL

P2LRN Analytics

embeddable panel educational analytics and learning analytics for learner tracking, course progress, activity, attempts and grades on websites and LMS platforms.

1. What it shows

Summary

learners, courses, enrollment, completion, average official grade, active time and signs that require review.

Learners

Progress, courses, attempts, active time, last activity and detail by course.

Courses

learners started and completed, average progress, average grade, passed, activity and attempts.

Notes

Distribution and grade book, expressly differentiating authoritative grades from informative scores.

Activity

Normalized learning events, categories, recent evolution and interactions received from Player and Host.

Signs

Transparent rules for inactivity, low progress, low grade, and repeated failed attempts.

2. Course data and results

The package .p2lrn defines the content and activities of the course. The monitoring of a realization comes from Player, from a result .p2lrn-result or from the platform where P2LRN is integrated.

Open an offline result

In Analytics, click Open result and select the .p2lrn-result. learner, course, attempt, openings, sessions, active time, events and available incidents are displayed.

From Studio

After reviewing a return click Open in Analytics. The result is transferred to the panel without having to select it again.

Platform data

A website or LMS can directly assign its dataset to the component to bring together multiple learners, courses, and authorized grades.

An offline score is not an official grade.

Analytics keeps imported scores from .p2lrn-result as informative. Only grades that are expressly marked as authoritative by an authorized source are included in official averages.

3. CDN

Load the component and give it the metrics of the open course from Player or results .p2lrn-result imported. It is not mandatory to use an API. The attribute src It only works when a metrics JSON document already exists, not to point directly to the file .p2lrn.

HTML
<script src="https://p2lrn.org/analytics/current/dist/p2lrn-analytics.js"></script>
<p2lrn-analytics id="course-analytics" course-id="current-course"></p2lrn-analytics>
<script>
  // courseDataset contains real metrics for this course, obtained from Player
  // or from already validated .p2lrn-result files; it is not the .p2lrn course file.
  document.querySelector("#course-analytics").data = courseDataset;
</script>

To set a specific prerelease, replace current by 0.5.0-alpha.11.

4. NPM

In projects with managed dependencies, install Analytics and register the component from your application.

Terminal
npm install @p2lrn/analytics@0.5.0-alpha.11
JavaScript / TypeScript
import '@p2lrn/analytics';

const panel = document.querySelector('p2lrn-analytics');
panel.data = courseDataset; // real course data and learner results
// refresh() is only needed when a dataSource or src has been configured.

5. Host Dataset

The contract uses six collections. Identifiers are opaque to Analytics and their meaning belongs to your platform.

learners

Authorized visible identity: ID, name, optional email, group, cohort, and tags.

courses

Course, code and presentation metadata.

enrollments

learner-course relationship and overall progress when the Host already calculates it.

attempts

Attempts, status, progress, timestamps and active time. An attempt at activity with entityId does not complete the course on its own; neither does an attempt failed. Overall completion requires completed enrollment, 100% explicit progress, or a completed course level attempt.

grades

Grades with value, maximum, passed and flag authoritative. For overall course averages, omit entityId or use the same courseId; an activity note with another entityId It appears in the book, but it does not alter the course average.

events

Standardized P2LRN events with learner, course, intent, category, context and payload.

JSON reduced example
{
  "learners": [{"id":"u-1","name":"Ana"}],
  "courses": [{"id":"c-1","title":"Mathematics"}],
  "enrollments": [{"learnerId":"u-1","courseId":"c-1","progress":0.72}],
  "attempts": [{"id":"a-1","learnerId":"u-1","courseId":"c-1","activeTimeMs":840000}],
  "grades": [{"learnerId":"u-1","courseId":"c-1","value":82,"maxValue":100,"authoritative":true}],
  "events": [{"type":"p2lrn:progress","timestamp":"2026-10-28T10:00:00Z","learnerId":"u-1","courseId":"c-1"}]
}

6. Platform data source

When P2LRN is integrated into a website or LMS, the platform can deliver the course dataset to the panel or implement a dataSource own. Analytics does not require a specific API path or derive invented metrics from course content.

JavaScript / TypeScript
const panel = document.querySelector('p2lrn-analytics');

panel.data = datasetDelCurso;

// O bien:
panel.dataSource = {
  async load(filtros) {
    return obtenerDatosAutorizadosDelCurso(filtros);
  }
};

If an application already has its own authenticated route, it can also use createHttpAnalyticsDataSource apuntando a that application path. P2LRN does not define or enforce a fixed URL.

Ratings are only considered official when the authorized source expressly marks them with authoritative: true. An offline result does not establish that indicator on its own.

The integrating application decides how it identifies the user and what data it can consult. The panel is limited to representing the received dataset.

7. Events and active time

The events of Player can be converted to learning-event/1. Analytics understands categories of lifecycle, navigation, evaluation, progress, completion, attention, media, interoperability, collaboration, and error.

For active time, the panel accepts activeTimeMs of the attempt and events p2lrn:active-time/p2lrn:attention. When it receives accumulated values ​​from the same attempt, it keeps the largest, avoiding adding the same interval twice.

8. Tracking signals

The signs are not a diagnosis or an automatic prediction. They are visible rules that the Host can adjust.

Inactivity

By default, 14 days without activity in an uncompleted course.

Progreso bajo

By default, less than 35% when the learner has already started.

Nota baja

By default, less than 60% on an authoritative note.

failed attempts

By default, two or more attempts with status failed.

The panel shows the reason for each signal so that a person can interpret it and decide what to do.

9. Component API

data

Directly allocate a dataset in memory.

dataSource

object with load(filters) to connect the Host.

refresh()

Reload the feed and recalculate the views.

setView(view)

Cambia entre overview, learners, courses, grades and activity.

selectLearner(id) / selectCourse(id)

They open the corresponding detail.

exportCsv(kind)

Export learners, courses or notes in CSV.

importOfflineResult(file)

Open a .p2lrn-result and converts it into an Analytics dataset, keeping its scores informative.

page-size / pageSize

Number of rows per page for learners and grade book. Default: 50; range: 10–200.

10. Aggregation API

You can also use Analytics without mounting the dashboard.

JavaScript / TypeScript
import {
  normalizeAnalyticsDataset,
  computeAnalyticsSnapshot,
  filterAnalyticsDataset,
  analyticsToCsv
} from '@p2lrn/analytics';

const dataset = normalizeAnalyticsDataset(raw);
const snapshot = computeAnalyticsSnapshot(dataset);
const csv = analyticsToCsv(snapshot, {kind:'courses'});

11. Web Component Events

p2lrn-analytics-ready

The component has been registered and is ready.

p2lrn-analytics-refresh

A data upload completed successfully.

p2lrn-analytics-select

A learner or course was selected.

p2lrn-analytics-export

A CSV was generated.

p2lrn-analytics-import

An offline result was successfully opened.

p2lrn-analytics-error

Loading the font failed.

12. Privacy and security

  • Do not include learners, emails, notes or history within a package .p2lrn.
  • Authorizes the Analytics endpoint based on the institution, role, course, and scope of the connected user.
  • Don't trust learnerId or courseId sent by the browser to decide permissions.
  • The CSV contains the data visible in the dashboard; Your download must respect your platform's policy.
  • Informational browser scores should not quietly become official grades.