Skip to content

Commit e8d88e0

Browse files
use dash as cookie separator to save on encoding characters
1 parent fc4fb91 commit e8d88e0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/collect-functions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ function determine_uniqueness(string $type, $thing): array
240240

241241
function determine_uniqueness_cookie(string $type, $thing): array
242242
{
243-
$things = isset($_COOKIE['_koko_analytics_pages_viewed']) ? \explode(',', $_COOKIE['_koko_analytics_pages_viewed']) : [];
243+
$things = isset($_COOKIE['_koko_analytics_pages_viewed']) ? \explode('-', $_COOKIE['_koko_analytics_pages_viewed']) : [];
244244
$unique_type = $type && !in_array($type[0], $things);
245245
$unique_thing = $unique_type ? true : !in_array($thing, $things);
246246

@@ -250,7 +250,7 @@ function determine_uniqueness_cookie(string $type, $thing): array
250250

251251
if ($unique_type || $unique_thing) {
252252
$things[] = $thing;
253-
\setcookie('_koko_analytics_pages_viewed', \join(',', $things), (new DateTimeImmutable('tomorrow, midnight', get_site_timezone()))->getTimestamp(), '/', "", false, true);
253+
\setcookie('_koko_analytics_pages_viewed', \join('-', $things), (new DateTimeImmutable('tomorrow, midnight', get_site_timezone()))->getTimestamp(), '/', "", false, true);
254254
}
255255

256256
return [$unique_type, $unique_thing];

0 commit comments

Comments
 (0)