var pairs = "".split("; "); var cookies = {"keycode":"","utm_campaign":"","utm_content":"","utm_medium":"","utm_source":"","utm_term":""}; for (var i = 0; i < pairs.length; i++) { var pair = pairs[i].split("="); if (pair[0] in cookies) cookies[pair[0]] = unescape(pair[1]); //cookies[pair[0]] = unescape(pair[1]); }