Forum Discussion
lemidadigital
5 months agoCommunity Member
Exporting Storyline variables to Google Sheets
Hello everyone, I have no programming background and would appreciate some help.
I am trying to export variables from Storyline to a Google Sheet. The course is published on the reach 360 platform....
SamHill
5 months agoSuper Hero
Hi lemidadigital​ rather than using jQuery which is redundant in this instance, you can use native JS to complete the same function:
console.log("JavaScript from Trigger is running!");
var player = GetPlayer();
document.addEventListener("DOMContentLoaded", function () {
fetch("https://script.google.com/macros/s/.../exec", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"FullName": player.GetVar("FullName"),
"Quiz1.ScorePercent": player.GetVar("Quiz1.ScorePercent"),
"Quiz2.ScorePercent": player.GetVar("Quiz2.ScorePercent"),
"Quiz3.ScorePercent": player.GetVar("Quiz3.ScorePercent"),
"Quiz4.ScorePercent": player.GetVar("Quiz4.ScorePercent"),
"Quiz5.ScorePercent": player.GetVar("Quiz5.ScorePercent"),
"Quiz6.ScorePercent": player.GetVar("Quiz6.ScorePercent"),
"Quiz7.ScorePercent": player.GetVar("Quiz7.ScorePercent"),
"Quiz8.ScorePercent": player.GetVar("Quiz8.ScorePercent"),
"Quiz9.ScorePercent": player.GetVar("Quiz9.ScorePercent"),
"Quiz10.ScorePercent": player.GetVar("Quiz10.ScorePercent"),
"Quiz11.ScorePercent": player.GetVar("Quiz11.ScorePercent"),
"Quiz12.ScorePercent": player.GetVar("Quiz12.ScorePercent")
})
})
.then(response => response.json())
.then(data => {
console.log("Data sent successfully:", data);
})
.catch(error => {
console.error("Error sending data:", error);
});
});
return false;
FYI: I haven't checked your script, but have just converted to use native JS so you do not need to load in any external JS libraries like JS, which is where the "$" related error is stemming from.
Related Content
- 10 months ago
- 10 months ago
- 10 months ago
- 10 months ago