Javascript Embedding Details

Find the embed code

Embedding Stim Admin viewer into a survey is very easy. Simply go to the “Embed” section in the menu in Stim Admin, and select your project.

You will then see some options to select which Stims to show, and their ordering. You can also toggle emotions on and off. The default options are usually fine.

Click the “Generate Code” button to generate Javascript code that you can paste into your survey platform.

All that remains is to wire-together all the events and parameters as described in our worked example.

Customizing the code

You may want to customize the Javascript code to handle events such as screenouts, incompatible devices/browser or other issues in a particular way. You may also want to programmatically modify the stims or behaviour of the Stim Admin viewer. These notes explain how to do this.


You can set the instructions and display language for the viewing process.


This is the ID of the user participating in the session, typically assigned by the survey tool or panel provider and will aid in identifying participants in the StimEngine UI. This is optional as the ID is only captured to aid in doing segmentation and reporting. You may also want to cross-reference results in Stim Engine with other data such as survey answers. If you need to do this, be sure to pass the participant ID into the Stim Admin viewer.

Calibration Points Before

These numbers dictate the number of calibration points shown before, between or after each stim. This number is multiplied by a factor of 5. As such the number ‘3’ represents 15 calibration points. Generally you should not change these parameters, but they exist to minimize the calibration effort and friction experienced by participants. When viewing a large number of stims, we can share the calibration between them resulting in less effort per stim overall. If the number of calibration points is set to zero, eye-tracking data will not be available. If the number of calibration points is too low, eye tracking will not be accurate.

Enabling emotion

Emotion tracking can be disabled by altering ‘true’ to ‘false’. This can be done in the UI in StimEngine or by changing the code. This will stop the session being analyzed for emotion, but does not alter any other portion of the user experience. As such this option is rarely used.

Detection behaviour

These statuses are tracked during the session and will enable custom behaviours once these statuses are detected. These are used in the worked example to stop a failsafe timer once the first face frame is detected. This is open to use for advanced users to create custom behaviour paths.

Error behaviour

These are errors which are reported by StimEngine and allow for custom behaviours by altering the code in these sections. This is recommended for advanced users only.


This sequence of digits relates to the ID of the Stims being viewed in this session. Multiple Stims are separated by a comma (,) e.g. (Stim 1, Stim 2)