вот, я потрудился))
<!DOCTYPE html>
<html>
<head>
<title>example</title>
</head>
<body>
<a href="?link=1" slink="link1">link 1</a><br>
<a href="?link=2" slink="link2">link 2</a><br>
<a href="?link=3" slink="link3">link 3</a>
<script>
Array.prototype.forEach.call(document.querySelectorAll('a'), function (ths)
{
ths.onclick = function ()
{
var ar = links.split('?');
ar.push(this.getAttribute('slink'));
sessionStorage.setItem('links', ar.join('?'));
};
});
var links = sessionStorage.getItem("links");
if (!links) links = '';
console.log(links.split('?'));
</script>
</body>
</html>