Picture of Lars Halkjær
xApi, preSendStatement
by Lars Halkjær - Friday, 10 December 2021, 10:40 AM
 

Plug-ins can listen to the xapi:preSendStatement and alter statements before they are tracked.

But is it possible to filter statements - that is prevent a statement form being tracked at all - using xapi:preSendStatement in a plug-in?

An example: If I wanted to track completion statements from a specific component (so it should not be blacklisted) but I only want them tracked, if a specific condition is met.

Picture of Oliver Foster
Re: xApi, preSendStatement
by Oliver Foster - Monday, 13 December 2021, 10:36 AM
 

No.

But xapi:preSendStatements you could probably remove items from the array such that they won't go into the for loop.


https://github.com/adaptlearning/adapt-contrib-xapi/blob/d875183131e6c42fb840cc93cbaae61d12e7c2e5/js/XAPI.js#L1449-L1456

Picture of Lars Halkjær
Re: xApi, preSendStatement
by Lars Halkjær - Monday, 13 December 2021, 11:46 AM
 

That looks like a nice way to do it - I will try that.

Thank you.