Skip to main content

Chi-tracker Reference

Core functions of the chiasm-tracker.js library.

Typical usage order

// Load the library
<script src="https://cdn.chiasm.eu/latest/chiasm-tracker.js"></script>

// 1. Initialize
const chiasm = await initChiasmTracker({ authToken: 'TOKEN' });

// 2. Set experiment info (experimentID, participantID, saveData)
chiasm.setExpInfo('abc123def456ghi789jkl012', 'participant_42', true);

// 3. Calibrate screen size
await chiasm.showScreenCalibration();

// 4. Set up tracker (webcam + calibration + validation)
await chiasm.setupTrackerWithRetries();

// 5. Record gaze data
await chiasm.startRecording('stimulus_1');
// ... show stimulus ...
await chiasm.stopRecording();

// 6. (Optional) Ensure all gaze data is returned
await chiasm.ensureAllPredictionsReturned();

// 7. Clean up
await chiasm.cleanupTracker();