Common xAPI & Storyline Troubleshooting Steps

By
Devlin Peck
. Updated on 
May 5, 2023
.
Troubleshooting xAPI and Storyline tutorial cover photo

The xAPI tutorials on this website are designed to help you send custom xAPI statements from your Storyline courses with as little friction as possible. However, due to the technical nature of these tasks, issues are bound to crop up.

This resource covers the most common issues that you can check your project for to ensure that your xAPI statements are sending successfully.

1. Check your "conf" object

For your statements to send successfully, you need to ensure that your "conf" object is set and sent successfully. This is what authorizes your statement with your LRS, so if this isn't set correctly, then your statements will not send to your LRS.

This is the template that the "conf" object in your JavaScript file should follow:

{% c-block language="js" %}
const conf = {
"endpoint": "https://yourendpoint.com/",
"auth": "Basic " + toBase64("APIKey:Secret")
};
ADL.XAPIWrapper.changeConfig(conf);
{% c-block-end %}

You need to replace the placeholders in the code above with your endpoint, your API key, and your Secret Key. Once you've declared the object, you set it using the changeConfig() function shown above.

See here if you need additional help setting the "conf" object.

2. Check the commas between your JSON objects

When you have a list of JSON objects, you need to ensure that there are commas between each of them. For example:

{% c-block language="js" %}
{
"key": "value"
},
{
"key2": "value2"
}
{% c-block-end %}

This holds true with lists of key-value pairs, as well as lists of objects within objects, like so:

{% c-block language="js" %}
{
"key": "value",
"key2": "value2"
},
{
"exampleObject": {
  "key3": "value3",
  "key4": "value4"
},
"exampleObject2": {
  "key5": "value5",
  "key6": "value6"
}
}
{% c-block-end %}

The example code at the end of each tutorial should have these commas in the correct place, but even experienced developers make silly errors like forgetting commas. Always double check your commas!

3. Ensure that you're passing strings to your functions

When you call your JavaScript function from your Storyline course, you need to make sure that you're passing strings as arguments. In JavaScript, strings are a type of data that contain a series of characters. However, they must be wrapped in single or double quotes.

Correctly calling your function will look something like this:

{% c-block language="js" %}
send_statement("initialized", "http://adlnet.gov/expapi/verbs/initialized", "Write xAPI Statement Tutorial", "http://www.devlinpeck.com/write-xapi-statement");
{% c-block-end %}

If you try executing that same function without quotes, nothing will happen. For example, the following code is incorrect:

{% c-block language="js" %}
send_statement(initialized, http://adlnet.gov/expapi/verbs/initialized, Write xAPI Statement Tutorial, http://www.devlinpeck.com/write-xapi-statement);
{% c-block-end %}

Again, make sure that you pass strings to your function (which basically means to ensure that you put your arguments within quotes).

As a follow-up on this troubleshooting step, make sure that your commas between values are outside of the quotes...not within them.

4. Check your spelling and capitalization

As you are likely aware, you must be very precise when writing code. JavaScript variables are case sensitive, so any variation in spelling or capitalization could completely break your code.

For example, let's say you define a variable like so:

{% c-block language="js" %}
const myVariable = "This is my variable!";
{% c-block-end %}

Now let's imagine that you try calling the variable by typing "myvariable". This will give you a result of "undefined" because, according to the code, there is no variable with that name.

{% c-block language="js" %}
console.log(myVariable) /* This will return your variable! */
console.log(myvariable) /* This will return undefined */
console.log(myVarible) /* This will also return undefined */
{% c-block-end %}

So, if you're having issues, it's a good idea to check all of your parameters and variables to ensure that you're consistent with your capitalization and spelling.

Your JavaScript variables also cannot start with numbers, so make sure you spell out your numbers if you've made this mistake:

{% c-block language="js" %}
const firstNumber = 1; /* This is correct! */
const 1stNumber = 1; /* This is incorrect. */
{% c-block-end %}

5. Execute your "Execute JavaScript" trigger correctly

It's possible that your statement isn't sending because the trigger isn't firing correctly in your Storyline course. Double check your Storyline file to ensure that your "Execute JavaScript" trigger is executing only after the necessary Storyline variables are defined.

You should also check the order in which your triggers are executing. If a button brings the user to the next slide before executing the "Execute JavaScript" trigger, then the JavaScript will never get executed as needed.

6. Try Another Learning Record Store (LRS)

If you've tried all of the other steps and your statements still are not sending as desired, you may want to try another LRS. I suggest this because many users have reported having issues with SCORM Cloud LRS.

If you do decide to try another LRS, make sure that you update the "conf" object in your JavaScript file accordingly.

Still experiencing technical issues?

Following the troubleshooting steps on this page will resolve most potential technical issues. If you have additional questions or need additional help, feel free to ask in the eLearning Development space in the ID community.

Return to the Full Guide to xAPI and Storyline.

Devlin Peck
About
Devlin Peck
Devlin Peck is the founder of DevlinPeck.com, where he helps people build instructional design skills and break into the industry. He previously worked as a freelance instructional designer and graduated from Florida State University.
Learn More about
Devlin Peck
.

Explore more content

Explore by tag