PennController.SetCounterGlobal Commands

PennController.SetCounter() (since PennController 1.1)

or PennController.SetCounter( "label" ) (since PennController 1.1)

or PennController.SetCounter( number ) (since PennController 1.1)

or PennController.SetCounter( "label" , number ) (since PennController 1.1)

Creates an item that will set Ibex’s internal counter when it is run.

Ibex has an internal counter which keeps track of how many people participated in your experiment in order to automatically handle group designs. By default, the counter is incremented at the end of the experiment, which has the undesirable effect of assigning the same group to all the participants who click your link before anyone has completed your experiment. You can choose to run PennController.SetCounter at the very beginning of your experiment instead.

You can give a label to the item by passing a string as an argument which you can refer to in PennController.Sequence (e.g. you can make it the first item to run and therefore increment the counter at each click).

You can also pass a number, as the single argument if you define no label, or as the second argument if the first is a string for the label. The number will be used to increment (if positive) or decrement (if negative) the counter by its value.

Example:

[js try=”data” highlight=”1″]
PennController.SetCounter();

PennController.AddTable( “myTable” ,
“Group,Button\n”+
“A,Hello\n”+
“B,World”
);

PennController.Template(
row => PennController(
newButton( “greetings” , row.Button )
.print()
.wait()
)
);
[/js]

Increments the counter as soon as the experiment starts running. Since we use a table defining two groups (A and B) the button will read Hello or World every other time the experiment is run.