Posting storyline variables to Google Spreadsheet
Apr 05, 2014
Hello,
I have been researching high and low, but I'm having the toughest challenge trying to get a few storyline variables written to a Google spreadsheet. I am not a programmer, but I think I've got it on the right track. I would be most grateful for anyone who might be able to help.
I am not using an embedded Google form, I'm simply trying to pass the values of three storyline variables to a Google Spreadsheet.
Google spreadsheet URL: https://docs.google.com/a/hubbardswim.com/spreadsheet/ccc?key=0Atly3766dLx3dFI2YUNHcnNQSXZZSlU1YWs4RGRGNlE&usp=drive_web#gid=0
In the <head> of my story.html file I have added a couple of lines:
<script src="story_content/postGoogle.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
the postGoogle.js file is located in the "story_content" folder on my server. I have a "submit to google" button setup in storyline, with a trigger that calls for the following javascript to be executed onClick:
var player = GetPlayer();
postContactToGoogle();
I'm making the estimation that Storyline is using the names given to objects/fields in the project as "id" tags that can be referenced in JavaScript (the same way you would for an HTML page). This might be one of my errors. Based on this assumption, I have a text entry field named "txt_firstName" where a user inputs their first name. I'm using '#txt_firstName' to get the variable value in my postContactToGoogle function.
I do have triggers set up for txt_firstName and txt_lastName to set the new variables (firstName and lastName) to the typed value when the control loses focus.
On my postGoogle.js file it looks as such:
function postContactToGoogle(){
var firstName = $j('#txt_firstName').val();
var lastName = $j('#txt_lastName').val();
var Results.ScorePercent = $j('#txt_yourGrade').val();
{
$j.ajax({
url: "https://docs.google.com/forms/d/0Atly3766dLx3dFI2YUNHcnNQSXZZSlU1YWs4RGRGNlE/formResponse",
data: {"entry.1" : firstName, "entry.2" : lastName, "entry.3": Results.ScorePercent},
type: "POST",
dataType: "xml",
statusCode: { //redirect to thank you page if 0 or 200
Full postGoogle.js file attached.
Many thanks for any help and/or guidance.
5 Replies
Dan there was a post about this a few months back where someone successfully did this. Not sure where it's at. When I get back into the office I will try and find it and send it.
Is this what you are after? http://community.articulate.com/forums/p/12250/73837.aspx
Hi Dan and welcome to Heroes!
I'm glad John and Mark were able to help you out here, and please let us know if you need anything else.
Hi Dan,
I know I am a little late to the party here, but I am trying to do the same thing and was wondering if you ever got an answer to this. I can embed the form in the page just fine but I would rather post the Storyline variables to the Google doc.
Thanks!
Hi Kyle!
I think that was Dan's only post, and this thread is a bit dated, so not sure that he will be able to assist.
I'm sure that someone in the community can and perhaps this similar thread will assist as well.
This discussion is closed. You can start a new discussion or contact Articulate Support.