Track the results of anonymous visitors

Currently, only the results of authenticated users seems to be tracked. It would be great if there was an option to track the results of all visitors, including anonymous visitors.


When h5p nodes are embedded from a drupal site that does not require authentication to view content, the results of users viewing the content or embed is not tracked.

Possible solutions:

  • H5P content will prompt user for email address (do not show prompt for logged in user, pass the values through).
  • Assume that h5p content is always visible with login: allow content author to request certain fields, such passphrase, email, name, etc., to access
  • Track anonymous users and set name to 'anonymous' - the results are tracked so at least the content author has some metrics to work with.
  • Force account creation on drupal


Track anonymous users
Issue Status: 
Supporter votes Members of the Supporter Network can vote for feature requests. When the supporter network has generated sufficient funding for the top voted feature request it will normally be implemented and released. More about the H5P Supporter Network
tim's picture

Hi ymdahi,

those are some great suggestions, I think the third is the most fitting as it's the least intrusive. I've added this feature request to the feature request list and there it will be prioritised for development. 

- Tim

Hi there, just found h5p last week, and was hoping to have a quiz that can be tracked both anonymously and logged in. I think this update would pretty much round out all our requirements for quizzes.

BV52's picture

Hi osu_drupal,

Welcome to H5P!

Thank you for input.


otacke's picture

If you don't fear using a Learning Record Store, then this should already be possible by directing the xAPI statements from H5P there.

@otacke, thanks for that insight! That would be an ideal workaround - have you implemented an LRS for this purpose?

Are there any differences between how h5p stores interactions locally and how an LRS would store those same interactions?

Any other insight to share in regards to LRS+h5p? Have you used Learning Locker with h5p?

Sorry for the million questions, and thank you for your insight.

otacke's picture


I wouldn't call using xAPI a workaround ;-) It's really a great solution if you want to track results and maybe gain some more detailed insights into what students are doing.

Building a fully featured LRS is quite a huge task, and I have not done that. No. I created a tiny surrogate for WordPress, but that's it.

Scope and depth of what the H5P plugins store and what an LRS stores are quite different. The H5P plugins are mostly concerned with the scores, but not with storing all the other information. It uses xAPI to send those somewhere else. That's not a flaw, but a deliberate choice. I blogged about that issue just recently: Putting it in a nutshell: H5P does not intend to replace a LRS. Still, will at least offer some more insight than just the scores soon(ish).

Learning Locker is great. I had a peek a few month ago. Installing it was a little tedious, but worth the effort. Alternatively, you could use it as a service, too. Also, there are other LRS you might have a look at, e. g. Grassblade or Watershed.

Guess it's time for a new blog post ;-)

Thanks mate, that was very informative - would love to see a similar module in Drupal for catching the xapi statements. Also, please do post a link if you end up writing an article.

I've set aside some time to take a serious look at LRSs, specifically Learning Locker, Grassblade, and Watershed.

The concept of xAPI->LRS seems pretty simple - I'm wondering what sort of gotch'yas I'll run into if I just build a restful api from drupal that outputs these noun-verb-object statements. A statement like 'Sarah attempted Quiz 1 at 01/01/2018 11:11:11' is pretty easy to capture and output with drupal. If I find the time, I may attempt this.

otacke's picture

Hi ymdahi!

Thanks for your kind words. I have never created a plugin for Drupal, but I guess it wouldn't bee too complicated to use my code to build something similar. And it's not much code. If you want to give it a try, go ahead!

I had originally assumed I would need to get users to log in to take the H5P quizzes in our programming, but I'm beginning to wonder whether I can use the Questionnaire library to collect the "crosstab" data (attributes to be used for analysis of results, e.g. for groups to win prizes for best aggregate scores). This would require the ability to collect scores from each anonymous user along with their questionnaire responses in a report from an event.

Do you think this would be possible with the current offerings of H5P in Drupal 8? In other words, is the data for each anonymous session collected in a way that can be keyed to the questionnaire in the same session?

icc's picture

That data is not gathered but you could create a custom module or theme that adds a JavaScript that will collect the events and their data and then you may store or do whatever you like to them. To just have them printed in the browser's console you can do the following:

H5P.externalDispatcher.on('xAPI', function (event) {

Just make sure the module/theme adds and loads the scripts after the H5P module.


I was very disapointed to see that the result of anonymous users on Drupal 8 where not counted... I just want to say I'd be waiting on any solutions to do that, except the crazy thing about module with javascript or xAPI stuff...  just plain drupal h5p core solution.

I'd be happy to contribute by paying a module, but not developping my own special thing...

BV52's picture

Hi seyfcom,

Thank you for offering funding for this. To contact the core team directly please use this contact form.