I can't remember the finer details of using sessions, or more specifily what their lifespan and visibility is.
But this could very simply be achieved with an ajax call and a php file. What I have in mind is something this (with error checking removed for simplicity):
$varName = $_GET['varName'];
$value = $_GET['value'];
$_session[$varName] = $value;
var name = 'enhzflep';
var url = 'setSesion.php?varName=name&value=' + name;
Where getAjaxRequest was a function that would perform an ajax call to the specified url but do nothing when the call was complete - or at least dislay nothing if all was well. You could have the php send back a status message that you then check for before continuing.
Everyone's using jQuery these days, though you can write the function yourself or use a purpose built ajax library in well under 4kb - or about 4.5% of the size of jquery.min.js
For reference, I use as compressed version of this: AjaxRequest