Skip to content

Instantly share code, notes, and snippets.

@MyCueCards
Created July 19, 2018 17:16
Show Gist options
  • Save MyCueCards/b32f9fd2a563589e9fdead2c27a84f9a to your computer and use it in GitHub Desktop.
Save MyCueCards/b32f9fd2a563589e9fdead2c27a84f9a to your computer and use it in GitHub Desktop.
In Google Tag Manager, get a variable session storage. This is entered into GTM as "Customer JavaScript" variable. The result is also a variable as a "1st Party Cookie."
function ()
{
var result = '';
if(typeof(Storage) !== 'undefined')
{
if (typeof(window.sessionStorage._enterCookieName) !== 'undefined')
{
result = window.sessionStorage._enterCookieName + '';
}
}
else
{
result = {{enter_1stPartyCookie_VariableType}};
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment