Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time

Implementing the Google Script Data Collector

For the Google option, you will need to go to Google Drive and create three spreadsheets in Google Sheets. One sheet will be used to store the raw data (database), one sheet will be used to store spliced data (splicedDataset), which will then be used to check compliance, and one sheet will be used to store compliance rates (compliance). For each spreadsheet, note the ID of the sheet. The sheet id is used to tell the web app where to write the data and is found in the URL for the Google sheet. It is a long string of letters, numbers, and symbols that appears before “/edit#gid=…” You can also create a Google Document that will act as a log of the web app’s activities.

  1. Go to Google Script.
  2. Select a Blank Project in the top left of the menu of the pop-up dialog. You can copy and paste the script from this page or from GitHub.
  3. You will then replace the variables databaseID, splicedDatabaseID, complianceID, and DocumentID, in the example code with the ids you stored for the raw data spreadsheet, the spliced data spreadsheet, the compliance data spreadsheet, and the web app log, respectively.
  4. Save the script.

You are now ready the test and potentially deploy the data storage web app.

  1. Click on the debug icon, which looks like a bug and is located beside the dropdown menu titled Select function.
  2. The script will then ask for Authorization. Select Review Permissions.
  3. Click on your Google Account
  4. You will see "This app is not verified" on the screen. Click on Advanced underneath it.
  5. Scroll down and click on Go to Untitled project (unsafe) Note: the name of the project may vary depending on how you have named your project.
  6. Then click Allow. You will most likely get an email from Google notifying you that an unverified app has been made.
  7. To deploy as a web app, a project version needs to be created.
  8. Go to Publish then Deploy as web app.
  9. In the dropdown menu for Who has access to the app, select Anyone, even anonymous.
  10. Then click Deploy. Copy the URL that appears below Current web app URL. You need this URL to input into your ExperienceSampler code so that the app knows where to send the data.

saveData functions

Next, you will need to tell the ExperienceSampler where to send the data by locating the saveData and saveDataLastPage functions in the index.js file and copying and pasting the URL for the Google web app.

The only difference between the saveData and saveDataLastPage functions is that participants will be notified whether the data was sent to the server successfully when the saveDataLastPage function is executed but not when the saveData function is executed. These functions ensure that the data is being sent to the server as often as possible so that participant data files are as up-to-date as possible. This allows for the most accurate records of response compliance (i.e., using the saveData function) that can be checked daily using our automated compliance checking program but not annoy participants by notifying them every time their data has been sent successfully. We chose to only notify participants when they would naturally expect to receive such confirmation – when they have completed the survey. If you choose not to notify participants, then you only need to implement the saveData function; however, we would advise you to use the saveDataLastPage function during testing to ensure that your data is being sent and saved correctly.