SL to GoogleSheets

Sep 24, 2015

Hi,
I have been following the threads on getting variables out of SL and into GoogleSheets with interest as I have a tutorial that this would be great to use with. I'm at the testing stage just now and have hit a problem. Can anyone help me out please.

The problem is that the values are not getting posted to the GoogleSheet.

This is my SL to GoogleSheets demo (expires in a few days)

Ive attached the demo zip and a document which its based on for your reference.

6 Replies
Bruce Holliday

Hi Mark,

Well spotted! I must admit I didn't check that code copied from an article, just shows. Anyway fixed that and also discovered a missing tag in the button code.  This code below works if anyone is interested.

// This event could be setup on a button press or a timeline event

var player=GetPlayer();
var name=player.GetVar("name");
var email=player.GetVar("email");
//set this to the form submit address gathered earlier
var fTarget="https://docs.google.com/forms/d/xxxxxxxxxxxxxxxxxxxx/formResponse";
function submit_form(){$.ajax({
url: fTarget,
type: "POST",
data: {"entry.yyyyyyyyyyyyyy" :name,"entry.zzzzzzzzzzzz":email},
success: function(data) {
//won't return since it's cross domain
}
});
return false;
}
//slight delay for older browsers
setTimeout(submit_form(), 2000);

 

Godfrey Sovis

Hi Bruce,

Thanks so much for your hard work. It is an excellent method. I spent hours and hours on forums to find a method to take out the variable values from SL to an external file, especially to a google form. I could not find any post except yours.

I downloaded the files you have posted & slightly amended them to suit my resources. Unfortunately, it did not work. I have attached the file. I would be grateful if you could find the mistake I have made. Thanks so much again.

This discussion is closed. You can start a new discussion or contact Articulate Support.