Getting Started with xAPI

Forums: 

Hello,

I'm interested in sending xAPI statements from H5P content types. I'm following the instrutions here: https://h5p.org/documentation/x-api and trying to get an xAPI statement to appear in the console with no luck. I have tried with an interactive video on the H5P site and one on my own site. I toss the following code in the console, answer a question and get nothing. Can anyone help me out?

H5P.externalDispatcher.on('xAPI', function (event) {  console.log(event.data.statement);});
Content types: 
serettig's picture

I've tried it out on my machine and running the command in the console works for me on h5p.org. I can see xAPI statements being shown in the Interactive Video content type and others. Maybe this is related to how the content you're trying this on is embedded? Possibly, the xAPI statements can't be passed outside an iframe and the page that uses an iframe to embed h5p content can't receive the statements?

serettig's picture

If you're using WordPress you can try out otacke's h5pxapikatchu module: https://github.com/otacke/h5pxapikatchu