[Home] >  Misc >  Get the value of a cookie

Get the value of a cookie

JavaScript version

const cookie = (name) => `; ${document.cookie}`.split(`; ${name}=`).pop().split(';').shift();

Examples

cookie('_ga'); // GA1.2.825309271.1581874719