There is a generic interface to the eye tracking functionality. As long as the appropriate callback functions are written for an eye tracker, no code needs to be changed in your task.
To configure MGL to use an eye tracker you must initialize the eye tracker support. The eye tracker configuration is specified in the eyetracker field of myscreen.
You should start by specifying whether to save the data (in a file) and what data you need.
myscreen.eyetracker.savedata = true; myscreen.eyetracker.data = [1 1 1 0]; % don't need link events
You also need to specify one of your tasks (or which of your phases) you want to use to control the eye data timing. This task will define what is a block, trial, etc.
task{1}.collectEyeData = true;
Next you initialize MGL's eye tracker support for your eye tracker.
myscreen = initEyeTracker(myscreen, 'Eyelink');
And finally you need to run a calibration.
myscreen = calibrateEyeTracker(myscreen);