Solved.
In case anyone else needs this: I needed to append the URL with a session id. Mine is actually called Sessiontab. Where the zone is defined in the JS code, I added this to it:
&sessiontab=" + document.querySelector('[name=SESSIONTAB]').value);
So this is what it would look like:
document.write ("?zoneid=6&sessiontab=" + document.querySelector('[name=SESSIONTAB]').value);
On the adserver where I enter the information for the banner, I needed to add a variable to the URL. It looks like this:
&sessiontab={sessiontab}
I used ampersand, because I already used a ? in the string.