One way to implement the functionality you want is to combine a Config.navigation.override handler with an Integer variable on the special setup object to track each time the Reader selects either one of your links or one of the navigation links.
Add the following to your story's Story Javascript area.
/* Track the number of steps (links) that are selected during the story's life-cycle. */
setup.steps = 0;
Config.navigation.override = function (destinationPassage) {
/* Increment the counter. */
setup.steps++;
return falue;
};
... You can test the above by adding the following to the StoryCaption special passage.
Steps: <<= setup.steps>>
NOTE: Your question left out an important detail about if your story allows the Reader to use the built-in Save/Load functionality, and if so how to handle the steps counter during a Load so that it is 'reset' back to the value it was at the time the Save was made.
The following code handles the saving and loading of the setup.steps variable, it also needs to be placed within your story's Story Javascript area.
Config.saves.onSave = function (save) {
var metadata = {steps: setup.steps};
save.metadata = JSON.stringify(metadata);
};
Config.saves.onLoad = function (save) {
var metadata = JSON.parse(save.metadata);
/* The Load process calls the navigation.override handler, which will result it the steps counter being one higher than it should be and thus the need to decrement the value stored within the save by one. */
setup.steps = (metadata.steps - 1);
};