WARNING: My knowledge of Javascript is limited, you may want to get the advice of a more experienced Javascript writer/coder.
If you are asking how to track which links (in your story) the Reader clicked on to arrive at the current passage being show then you could do something like the following.
1. Initialise a story variable to store the link text of each link selected by the Reader.
This should be done in your story's StoryInit special passage, and the variable is initialised to an empty Array.
<<set $linkHistory to []>>
2. Create a postrender Task Object to handle the tracking of each link selection.
The following code should be placed within your story's Story Javascript area, it creates a postrender task named Link Tracking which appends an extra click event to each of the links within the current passage being shown.
postrender["Link Tracking"] = function (content, taskName) {
$(content).find("a.link-internal").click(function() {
State.variables["linkHistory"].push($(this).text());
});
};
... the above appends the link text of the selected link to the Array stored within the $linkHistory story variable.
note: The above only tracks the links within the passage itself, it does not track links within the StoryMenu or StoryCaption areas.