// Handle the parsing of the _ga cookie or setting it to a unique identifier
function gaParseCookie($ga_cookie = NULL) {

$cookie_ga = isset($_COOKIE['_ga']) ? $_COOKIE['_ga'] : $ga_cookie;

  if (isset($cookie_ga)) {
    list($version,$domainDepth, $cid1, $cid2) = explode('.', $cookie_ga);
    $contents = array('version' => $version, 'domainDepth' => $domainDepth, 'cid' => $cid1.'.'.$cid2);
    $cid = $contents['cid'];
  }
  else $cid = ''; 
  return $cid;
}