Skip to content

Instantly share code, notes, and snippets.

@dan-laskowski
Created May 5, 2021 12:08
Show Gist options
  • Save dan-laskowski/baffa1398acb46bcd924ebc65443a3a8 to your computer and use it in GitHub Desktop.
Save dan-laskowski/baffa1398acb46bcd924ebc65443a3a8 to your computer and use it in GitHub Desktop.
[Get the value of a specified cookie] #javascript #js #cookie #value
// Get the value of a specified cookie
cookie = name => `; ${document.cookie}`.split(`; ${name}=`).pop().split(';').shift();
cookie('_ga');
// Result: "GA1.2.1929736587.1601974046"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment