Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there anyway to trigger contentUserData on an action #77

Open
csb346 opened this issue Jan 15, 2020 · 2 comments
Open

Is there anyway to trigger contentUserData on an action #77

csb346 opened this issue Jan 15, 2020 · 2 comments

Comments

@csb346
Copy link

csb346 commented Jan 15, 2020

Hi!
I've used the H5P PHP Library to implement an integration of H5P on a multi tenant Laravel application. The system can manage libraries on a shared base and contents (database and storage) are fully separated between tenants.
Each tenant's admin have access to the editor and manage his own h5p contents, available for all users attached to this tenant.
Despite some less important details, I am now trying to get statistics (xAPI) and save user's state.
If I did understand, H5P sends a post request to contentUserData url to save user's data, and it does that on a time interval base saveFreq setting.
Is there trigger that request on every click or at least on every answered question, whatever the library?

Thanks for the help.

@otacke
Copy link
Contributor

otacke commented Jan 15, 2020

Hi @csb346 !

The function that saves user state is also triggered when H5P main content sends out xAPI events that use the verb "answered" or "completed", cmp.

H5P.xAPICompletedListener = function (event) {
if ((event.getVerb() === 'completed' || event.getVerb() === 'answered') && !event.getVerifiedStatementValue(['context', 'contextActivities', 'parent'])) {
var score = event.getScore();
var maxScore = event.getMaxScore();
var contentId = event.getVerifiedStatementValue(['object', 'definition', 'extensions', 'http://h5p.org/x-api/h5p-local-content-id']);
H5P.setFinished(contentId, score, maxScore);
}
};

Best,
Oliver

@csb346
Copy link
Author

csb346 commented Jan 15, 2020

Thanks! My french colleague is developping that part... I'll pass it on...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants