You are here

function _shurly_analytics_cookies in ShURLy 8

Same name and namespace in other branches
  1. 7 shurly_analytics/shurly_analytics.module \_shurly_analytics_cookies()

Function to retrieve the cid from the cookie Taken from http://www.stumiller.me/implementing-google-analytics-measurement-protoc...

1 call to _shurly_analytics_cookies()
shurly_analytics_shurly_redirect_after in shurly_analytics/shurly_analytics.module
Implements shurly_redirect_after().

File

shurly_analytics/shurly_analytics.module, line 54
Analytics ShURLy functionalities.

Code

function _shurly_analytics_cookies() {
  if (isset($_COOKIE['_ga'])) {
    list($version, $domainDepth, $cid1, $cid2) = preg_split('/[\\.]/', $_COOKIE['_ga'], 4);
    $contents = [
      'version' => $version,
      'domainDepth' => $domainDepth,
      'cid' => $cid1 . '.' . $cid2,
    ];
    $cid = $contents['cid'];
  }
  else {
    $cid = _shurly_analytics_get_uuid();
  }
  return $cid;
}