Support Home Legacy Tools Code Editor Samples

Gorilla Code Editor Samples List

  • Overview
  • Corsi Block Tapping
  • CyberBall
  • Digit Span
  • Headphone Check Task
  • JsPsych GoNoGo Example
  • Questionnaire Using HTML Forms
  • Questionnaire Constructor Basic
  • Questionnaire Constructor Advanced
  • Reveal Demo
  • Shopping Comparison Task
  • Stroop
  • Towers of Hanoi
  • Virtual Chinrest Task
  • iFrame
Warning

You're viewing the support pages for our Legacy Tooling and, as such, the information may be outdated. Now is a great time to check out our new and improved tooling, and make the move to Questionnaire Builder 2 and Task Builder 2! Our updated onboarding workshop (live or on-demand) is a good place to start.

Overview


This page contains a complete list of scripts available in the Code Editor Example Tasks library.

These example tasks were created using the Gorilla Code Editor. Here you will find a brief description of each task, along with a list of the gorilla functions (uses) it implements and some general concepts that each task covers. For reference to each of the gorilla functions visit our API here.

More Code Editor tutorials and practical examples can be found in our How To: Code Editor guide.


Note

You will notice that some of the samples were created using an older version of Gorilla Code Editor. While these examples can still be cloned and adapted for your tasks, we no longer support the old Code Editor and therefore would not be able to advise you on using these examples.

The new Code Editor was created to make coding simpler and more intuitive. To familiarise yourself with the new editor, see our Code Editor demo.

code editor old new

Corsi Block Tapping


Corsi Block Tapping

This script builds a Corsi Block Tapping task which assesses participant's visuo-spatial short term working memory. In this task, participants are presented with a number of blocks that flash in a sequence which needs to be repeated by tapping the correct blocks.

Uses: manipulation, ready, run, populate, refreshLayout, responsiveFrame, store, metric, finish

Concepts: create a display, store participants' responses and save them to metrics


Note: This sample was created using an older version of Gorilla Code Editor. While it can still be cloned and adapted for yout tasks, we no longer support the old Code Editor and therefore would not be able to advice you on using this example.

CyberBall


CyberBall

This task contains an implementation of the Cyberball paradigm for use online. This is based on the no-longer available version 4 of Cyberball, first developed by David Yeager, now at the University of Texas-Austin. Initial conversion work was started by Alexander Anwyl-Irvine and later completed by William D Webster in 2021. The settings_file_name manipulation allows you to choose a settings file appropriate for your paradigm (3 or 4 person, exclusion etc.) or you can add in your own!

Uses: manipulation, populate, populateAndLoad, resourceURL, run, metric, finish

Concepts: create an interactive display, use gorilla manipulations, set file format for task behaviour, save responses to metrics

Digit Span


Digit Span

This script builds a Digit Span task that tests participant's working memory. In this task, participants are presented with increasing sequences of numbers that they later need to recollect and repeat in the same order they were presented.

Uses: manipulation, retrieve, ready, responsiveFrame, populate, refreshLayout, store, run

Concepts: use gorilla manipulations, generate a display, store participants' responses

Headphone Check Task


Headphone Check Task

This task is a barebones implementation version of the Headphone Check API. The task checks functionality of participants' headphones.

Uses: ready, populate, store, finish, runS

Concepts: check functionality, store the result to embedded data

JsPsych GoNoGo Example


jsPsych GoNoGo Example

This task demonstrates how to set up a classic inhibition GoNoGo task from jsPsych in Gorilla.

Uses: ready, populate, stimuliURL, finish, metric,

Concepts: set up a JsPsych task in Gorilla, display stimuli, save responses to metrics

Questionnaire Using HTML Forms


Questionnaire Using HTML Forms

This task demonstrates how to use HTML 5 Forms and Bootstrap forms to create a Questionnaire.

Uses: ready, populate, metric, finish

Concepts: create a custom questionnaire, collate and submit responses, save responses to metrics

Questionnaire Constructor Basic


Questionnaire Constructor Basic

This task demonstrates how to use Typescript and Handlebars templates to custom build a Questionnaire using basic HTML 5 form elements. It will include much the same functionality as the 'Questionnaire Using HTML Forms' code task, except that, rather than using a premade questionnaire in a template, we'll dynamically build the questionnaire from smaller elements.

Uses: ready, populate, metric, finish

Concepts: build a custom questionnaire, save responses to metrics

Questionnaire Constructor Advanced


Questionnaire Constructor Advanced

This task demonstrates how to use Typescript and Handlebars templates to custom build a Questionnaire using basic HTML 5 form elements. Compared to the basic version, this example shows how you can build a questionnaire from code that has been divided up into three different files. Structuring our contents in this way make the individual files much easier to work with.

Uses: ready, populate, metric, finish

Concepts: dynamically build custom questionnaire from smaller elements, save responses to metrics

Reveal Demo


Reveal Demo

This is a demo of AirBnB or Ebay style shopping site where you investigate decision-making process for economic psychology problems.

Uses: ready, populate, metric, stimuliURL, startStopwatch, readStopwatch, stopStopwatch, manipulation, populateAndLoad, finish

Concepts: create an interactive reveal task, set gorilla manipulations, save responses to metrics

Shopping Comparison Task


Shopping Comparison Task

This task creates an online shop product comparison table from which participant selects a product.

Uses: ready, populate, finish

Concepts: create a display, force full size screen mode, show participants their answer

Stroop


Stroop

Stroop task is a classic neuropsychological test in which colour names mismatch and match their text colour, depending on the condition. Participants' reaction time to stimuli in different conditions is examined.

Uses: ready, shuffle, responsiveFrame, populate, refreshLayout, startStopwatch, stopStopwatch, store, getStopwatch, metric, finish, run

Concepts: set up and apply trials manipulations, randomise trials using gorilla.shuffle, store participants' responses and save them to metrics


Note: This sample was created using an older version of Gorilla Code Editor. While it can still be cloned and adapted for yout tasks, we no longer support the old Code Editor and therefore would not be able to advice you on using this example.

Towers of Hanoi


Towers of Hanoi

Tower of Hanoi is a classic task examining problem-solving abilities using a simple mathematical puzzle. The objective is to move all of the discs on the left-most 'tower' on to the right-most tower in as few moves as possible.

Uses: manipulation, retrieve, store, ready, populateAndLoad, refreshLayout, run, populate, metric

Concepts: create an interactive task, record number of participants' moves, store participants' responses and save them to metrics


Note: This sample was created using an older version of Gorilla Code Editor. While it can still be cloned and adapted for yout tasks, we no longer support the old Code Editor and therefore would not be able to advice you on using this example.

Virtual Chinrest Task


Virtual Chinrest Task

This task is based on the code available in the Virtual Chinrest github repository. The task tests participants' viewing distance from the screen.

Uses: ready, populate, metric, store

Concepts: create a display, store participants' responses and save them to metrics

iFrame Example


iFrame Example

An iFrame is a special HTML element that allows you to embed another webpage. You can pass messages between the iFrame and the main webpage. In Gorilla, you can take a task that you're hosting somewhere and embed this within the Gorilla task. Then, Gorilla can listen for the messages to log metrics or mark the task as complete. You can read more informaiton about how to set up an iFrame within Gorilla on this page.

Uses: ready, metric, finish

Concepts: embedding external webpage, passing and listening to messages and saving them to metrics.