|
1 | 1 | ---
|
2 |
| -title: Basic Completion tracking |
| 2 | +title: Basic completion tracking |
3 | 3 | group: Documents
|
4 | 4 | category: Features
|
5 | 5 | ---
|
| 6 | + |
6 | 7 | # Basic completion tracking
|
7 | 8 |
|
8 | 9 | The H5P client is capable of sending a message to the server when the user has
|
9 |
| -completed a content object. This includes the time when this occured, how long |
| 10 | +completed a content object. This includes the time when this occurred, how long |
10 | 11 | the content was open, the achieved score and the maximum score.
|
11 | 12 |
|
12 | 13 | While technically this message is derived from a xAPI statement generated by the
|
13 | 14 | content types, it **is not the same as xAPI** and is a completely separate
|
14 | 15 | system that co-exists with xAPI and a potential LRS. You can enable completion
|
15 |
| -tracking and xAPI tracking indepedently. |
| 16 | +tracking and xAPI tracking independently. |
16 | 17 |
|
17 | 18 | If you want to capture all xAPI statements, which allows you to have very
|
18 | 19 | detailed tracking, you either have to inject your own xAPI capturing JavaScript
|
19 |
| -or use the xAPI capabilities of the `H5PPlayerComponent` in the [webcomponent |
20 |
| -package](../../packages/h5p-webcomponents/README.md) (or the corresponding functionality |
21 |
| -in the [React package](../../packages/h5p-react/README.md)). |
| 20 | +or use the xAPI capabilities of the {@link |
| 21 | +@lumieducation/h5p-webcomponents!H5PPlayerComponent} in {@link |
| 22 | +"@lumieducation/h5p-webcomponents"} (or the corresponding functionality in |
| 23 | +{@link "@lumieducation/h5p-react}). |
22 | 24 |
|
23 | 25 | ## How it works
|
24 | 26 |
|
25 |
| -- When the user presses "check", a xAPI statement indicating completion is |
26 |
| - generated by the content type (that supports it). The H5P client captures it |
27 |
| - and calls an AJAX route on the H5P server with basic information. |
28 |
| -- The H5P server saves the completion data in a special storage system. The |
29 |
| - server automatically deletes the data when the content object is deleted. |
| 27 | +- When the user presses "check", a xAPI statement indicating completion is |
| 28 | + generated by the content type (that supports it). The H5P client captures it |
| 29 | + and calls an AJAX route on the H5P server with basic information. |
| 30 | +- The H5P server saves the completion data in a special storage system. The |
| 31 | + server automatically deletes the data when the content object is deleted. |
30 | 32 |
|
31 | 33 | ## Limitations
|
32 | 34 |
|
33 |
| -- While the storage classes support retrieving and deleting the completion data, |
34 |
| - there are no endpoints on the `h5p-express` package that implement this |
35 |
| - functionality. You have to implement these endpoints yourself. |
36 |
| -- Not all content types emit xAPI statements indicating completion and thus |
37 |
| - the tracking isn't fired. |
| 35 | +- While the storage classes support retrieving and deleting the completion |
| 36 | + data, there are no endpoints on the {@link "@lumieducation/h5p-express"} |
| 37 | + package that implement this functionality. You have to implement these |
| 38 | + endpoints yourself. |
| 39 | +- Not all content types emit xAPI statements indicating completion and thus |
| 40 | + the tracking isn't fired. |
38 | 41 |
|
39 | 42 | ## Enabling completion tracking
|
40 | 43 |
|
41 |
| -- Create an instance of `IContentUserDataStorage`. The recommended storage class |
42 |
| - for production is `MongoContentUserDataStorage` in the |
43 |
| - `@lumieducation/h5p-mongos3` package. There's also a |
44 |
| - `FileContentUserDataStorageClass` in the `@lumieducation/h5p-server` package |
45 |
| - that you can use for development or testing purposes. |
46 |
| -- Pass the implementation of IContentUserDataStorage into the `H5PEditor` and |
47 |
| - `H5PPlayer` constructor. |
48 |
| -- Set `setFinishedEnabled` in `IH5PConfig` to `true`. |
49 |
| -- If you use `h5pAjaxExpressRouter` from the `@lumieducation/h5p-express` |
50 |
| - package, then the routes for the AJAX endpoint are automatically created. You |
51 |
| - can manually turn them on by setting `routeFinishedData` in the options when |
52 |
| - creating the route. |
53 |
| -- If you don't use `h5pAjaxExpressRouter`, you have to route everything |
54 |
| - manually. First get `ContentUserDataManager` from `H5PEditor` or |
55 |
| - `H5PPlayer`. Route this endpoint and return HTTP status code 200 with a JSON |
56 |
| - object that is based on `AjaxSuccessResponse` with empty payload: |
57 |
| - - POST {{setFinishedUrl}}/ -> `ContentUserDataManager.setFinished` |
| 44 | +- Create an instance of {@link |
| 45 | + @lumieducation/h5p-server!IContentUserDataStorage}. The recommended storage |
| 46 | + class for production is {@link |
| 47 | + @lumieducation/h5p-mongos3!MongoContentUserDataStorage} in the {@link |
| 48 | + "@lumieducation/h5p-mongos3"} package. There's also a {@link |
| 49 | + @lumieducation/h5p-server!fsImplementations.FileContentUserDataStorageClass} |
| 50 | + in the {@link "@lumieducation/h5p-server"} package that you can use for |
| 51 | + development or testing purposes. |
| 52 | +- Pass the implementation of {@link |
| 53 | + @lumieducation/h5p-server!IContentUserDataStorage | IContentUserDataStorage} |
| 54 | + into the {@link @lumieducation/h5p-server!H5PEditor.constructor | H5PEditor |
| 55 | + constructor} constructor and {@link |
| 56 | + @lumieducation/h5p-server!H5PPlayer.constructor | H5PPlayer constructor}. |
| 57 | +- Set `setFinishedEnabled` in {@link @lumieducation/h5p-server!IH5PConfig} to |
| 58 | + `true`. |
| 59 | +- If you use {@link @lumieducation/h5p-express!h5pAjaxExpressRouter}, then the |
| 60 | + routes for the AJAX endpoint are automatically created. You can manually turn |
| 61 | + them on by setting `routeFinishedData` in the options when creating the route. |
| 62 | +- If you don't use `h5pAjaxExpressRouter`, you have to route everything |
| 63 | + manually. First get {@link @lumieducation/h5p-server!ContentUserDataManager} |
| 64 | + from {@link @lumieducation/h5p-server!H5PEditor | H5PEditor} or {@link |
| 65 | + @lumieducation/h5p-server!H5PPlayer | H5PPlayer}. Route this endpoint and |
| 66 | + return HTTP status code 200 with a JSON object that is based on {@link |
| 67 | + @lumieducation/h5p-server!AjaxSuccessResponse} with empty payload: |
| 68 | +- POST {{setFinishedUrl}}/ -> {@link |
| 69 | + @lumieducation/h5p-server!ContentUserDataManager.setFinished} |
58 | 70 |
|
59 | 71 | ## Configuration options
|
60 | 72 |
|
61 |
| -- You can customize the URL to which the AJAX calls are made by setting |
62 |
| - `setFinishedUrl` in `IH5PConfig`. |
63 |
| -- You can enable or disable the feature by setting `setFinishedEnabled` in |
64 |
| - IH5PConfig. |
| 73 | +- You can customize the URL to which the AJAX calls are made by setting |
| 74 | + `setFinishedUrl` in {@link @lumieducation/h5p-server!IH5PConfig | IH5PConfig}. |
| 75 | +- You can enable or disable the feature by setting `setFinishedEnabled` in |
| 76 | + {@link @lumieducation/h5p-server!IH5PConfig | IH5PConfig}. |
65 | 77 |
|
66 | 78 | ## Security considerations
|
67 | 79 |
|
|
0 commit comments