Skip to content

Instantly share code, notes, and snippets.

@adamcrampton
Created April 1, 2019 05:15
Show Gist options
  • Save adamcrampton/6aaba3fe9917dace2c2178d9ec45476b to your computer and use it in GitHub Desktop.
Save adamcrampton/6aaba3fe9917dace2c2178d9ec45476b to your computer and use it in GitHub Desktop.
For use with GTM variable - checks for existence and value of cookie - returns null if not found
// Return either the value of the Adobe Audience Manage cookie or null
// Note the AAM cookie is set by a Cloudflare worker at the edge
function() {
return (document.cookie.match(/^(?:.*;)?\s*aam\s*=\s*([^;]+)(?:.*)?$/)||[,null])[1]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment