In this presentation, from xAPI Camp at DevLearn 2017, I discuss how easy it can be to use xAPI in your online products. It's so easy, it really only requires four lines of code!
RABBIT: A CLI tool for identifying bots based on their GitHub events.
xAPI Camp-Four Lines of Code
1. xAPI: Four Lines of Code!
Buckle up, folks…
We’re looking at
CODE!
2. Tracking Events
• What are the events you want to track?
– Video: Play, Pause, Complete
– Security System: ID Card Scan
– Beacons: Beacon found, Beacon Lost
• What data does each event make available?
• How do you detect each event?
• How will the event fire off the statement?
4. …is the same as:
{"actor":{"mbox":"mailto:Tom@example.com",
"name": "Tom
Tompson","objectType":"Agent”},"verb":{"id":"http:
//adlnet.gov/expapi/verbs/answered","display":{"e
n-
US":"answered”}},"object":{"id":"http://adlnet.gov/
expapi/activities/example","definition":{"name":{"e
n-US":"ExampleActivity”},"description":{"en-
US":"Exampleactivitydescription”}},"objectType":"A
ctivity"}}
5. Four lines of Code
1. Define the learning record store (LRS) and
authoritative credentials to a variable
2. Tell the browser to use that LRS/variable
3. Define the xAPI statement
4. Send the statement
5. Profit! (Optional)
6. Four lines of Code
1. Define the learning record store (LRS) and
the username and password to authenticate
var conf = {
"endpoint" : "https://lrs.adlnet.gov/xapi/",
"auth" : "Basic " + toBase64("xapi-tools:xapi-tools")
};
7. Four lines of Code
2. Tell the browser to use that LRS
ADL.XAPIWrapper.changeConfig(conf);
11. Tracking Video Events with HTML5
• HTML5 has a great set of APIs:
– Play – onPlay
– Pause –onPause
– Ended– Say it with me now… onEnded!
• When the user creates the event, the matching
API is fired, and you can send your statement!
• What data do you want to know about the user’s
interactions?