Forum Discussion
Exporting Variables into a Google Spreadsheet
Weird. It wouldn't allow my reply. Your script endpoint works fine. I pushed two submissions into your spreadsheet. What does your Storyline JS look like?
Copied directly from the forum discussions and then the KEY, variables and URL updated.
Script 1
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.src = '//code.jquery.com/jquery-1.11.0.min.js';
script.type = 'text/javascript';
head.appendChild(script)
Script 2
var player = GetPlayer();
//PLACE YOUR WEB APP URL
WEB_APP_URL = "https://script.google.com/macros/s/AKfycbx8Jx0m_R5XaGKIbOBcbQPZWwWjmPyXeiAN1E4HGdFfcsrwiuG-eiYWOfqpz9ae30X_rQ/exec";
// STORE ARTICULATE STORYLINE VARIABLES
// "Columnname_Google_Spreadsheet" : player.GetVar("Name_Storyline_Variable")
// ATTENTION: Use a comma if you use multiple Storyline variables
storyline =
{
"date" : new Date().toJSON().slice(0,10), //STORE DATE
"FirstLastName" : player.GetVar("FirstLastName")
}
Script 3
//DELAY SO JQUERY LIBRARY IS LOADED
setTimeout(function (){
//Export to Google
$.ajax({
url: WEB_APP_URL,
type: "POST",
data : storyline,
success: function(data)
{
console.log(data);
},
error: function(err) {
console.log('Error:', err);
}
});
return false;
}, 1000);