EthoVision XT 19 - JavaScript event
Last updated: Jul 29, 2026
JavaScript Event
Definition
A custom variable that processes raw data (for example, the subject coordinates, or the distance moved) and produces a point event (i.e., with no duration) for each sample of the track, based on an algorithm.
Use Cases
- Zone visits detector. For example, detect when the subject has visited 80% of the zones. Use the event to calculate the latency of that event.
- TIP An example JavaScript event variable that detects when a subject has visited a specific percentage of zones is available for download from the Noldus customer portal under Downloads > EthoVision XT > Drivers and tools. Simply copy the code to the JavaScript Event window and follow the instructions (see below).
Calculation
The main difference with the JavaScript continuous variable is that the value specified in SetOutput() is either 0 or 1 and has no duration.
See JavaScript Continuous > Calculation
How to Specify a JavaScript Event Variable
- In the Analysis profile, under Custom Variables, click the button next to JavaScript event.
- Follow the rest of the procedure in JavaScript Continuous > To Specify a JavaScript Continuous Variable.
Notes
- In the Trial Statistics tab, select Latency to First to calculate the latency of the event. Latency of a dependent variable is calculated from the start of the track, even when you define time bins and nesting intervals.
See Also
- JavaScript Continuous
- JavaScript State
- Commands and Functions for JavaScript Variables
JavaScript State
Definition
A custom variable that processes raw data (for example, the subject coordinates, or the distance moved) and produces a state (on/off) value for each sample of the track, based on an algorithm.
Use Cases
- Velocity bins. Get the per-sample values of velocity and create velocity bins, for example from 0 to 100 mm/s, from 100 to 200 mm/s etc.
- Aggregation detector. Calculate the number of subjects present in a zone and set the output of the variable to
1if the number of subjects exceeds a certain threshold. Use this variable for example to calculate the time that more than 50% of the subjects cluster in one zone. - TIP Examples of JavaScript state variables are available for download from the Noldus customer portal under Downloads > EthoVision XT > Drivers and tools. Simply copy the code to the JavaScript State window and follow the instructions (see below).
Calculation
The main difference with the JavaScript continuous variable is that the value calculated per sample and specified in SetOutput() is either 0 or 1. The variable has a duration based on the total number of 1s in the track or selected track segment.
See JavaScript Continuous > Calculation
How to Specify a JavaScript State Variable
- In the Analysis profile, under Custom Variables, click the button next to JavaScript state.
- Enter the code in the JavaScript State window.
- Next to Number of outputs, select the number of possible states of the variable. For example, in the Velocity example described above, select
4. - Follow the rest of the procedure in JavaScript Continuous > To Specify a JavaScript Continuous Variable.
Notes
- In the Trial Statistics tab, select Cumulative Duration to calculate the total time that the state variable is "on".
See Also
- JavaScript Continuous
- JavaScript Event
- Commands and Functions for JavaScript Variables
Source: EthoVision XT 19 Help, Noldus Information Technology