Skip to content
This repository was archived by the owner on Oct 21, 2024. It is now read-only.

Commit 8a0809c

Browse files
Adam Graymhadam
authored andcommitted
LocalStorage domain user ID is not persisted properly (close snowplow#627)
1 parent eda9454 commit 8a0809c

1 file changed

Lines changed: 17 additions & 16 deletions

File tree

src/js/tracker.js

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*
22
* JavaScript tracker for Snowplow: tracker.js
3-
*
4-
* Significant portions copyright 2010 Anthon Pang. Remainder copyright
3+
*
4+
* Significant portions copyright 2010 Anthon Pang. Remainder copyright
55
* 2012-2016 Snowplow Analytics Ltd. All rights reserved.
6-
*
7-
* Redistribution and use in source and binary forms, with or without
8-
* modification, are permitted provided that the following conditions are
9-
* met:
6+
*
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are
9+
* met:
1010
*
1111
* * Redistributions of source code must retain the above copyright
1212
* notice, this list of conditions and the following disclaimer.
@@ -476,11 +476,12 @@
476476
* Cookie getter.
477477
*/
478478
function getSnowplowCookieValue(cookieName) {
479+
var fullName = getSnowplowCookieName(cookieName);
479480
if (configStateStorageStrategy == 'localStorage') {
480-
return helpers.attemptGetLocalStorage(cookieName);
481+
return helpers.attemptGetLocalStorage(fullName);
481482
} else if (configStateStorageStrategy == 'cookie' ||
482483
configStateStorageStrategy == 'cookieAndLocalStorage') {
483-
return cookie.cookie(getSnowplowCookieName(cookieName));
484+
return cookie.cookie(fullName);
484485
}
485486
}
486487

@@ -795,10 +796,10 @@
795796
function asCollectorUrl(rawUrl) {
796797
if (forceSecureTracker) {
797798
return ('https' + '://' + rawUrl);
798-
}
799+
}
799800
if (forceUnsecureTracker) {
800801
return ('http' + '://' + rawUrl);
801-
}
802+
}
802803
return ('https:' === documentAlias.location.protocol ? 'https' : 'http') + '://' + rawUrl;
803804
}
804805

@@ -891,7 +892,7 @@
891892
combinedContexts.push(augurIdentityLiteContext);
892893
}
893894
}
894-
895+
895896
//Add Parrable Context
896897
if (autoContexts.parrable) {
897898
var parrableContext = getParrableContext();
@@ -944,9 +945,9 @@
944945
*/
945946
function getPerformanceTimingContext() {
946947
var allowedKeys = [
947-
'navigationStart', 'redirectStart', 'redirectEnd', 'fetchStart', 'domainLookupStart', 'domainLookupEnd', 'connectStart',
948+
'navigationStart', 'redirectStart', 'redirectEnd', 'fetchStart', 'domainLookupStart', 'domainLookupEnd', 'connectStart',
948949
'secureConnectionStart', 'connectEnd', 'requestStart', 'responseStart', 'responseEnd', 'unloadEventStart', 'unloadEventEnd',
949-
'domLoading', 'domInteractive', 'domContentLoadedEventStart', 'domContentLoadedEventEnd', 'domComplete', 'loadEventStart',
950+
'domLoading', 'domInteractive', 'domContentLoadedEventStart', 'domContentLoadedEventEnd', 'domComplete', 'loadEventStart',
950951
'loadEventEnd', 'msFirstPaint', 'chromeFirstPaint', 'requestEnd', 'proxyStart', 'proxyEnd'
951952
];
952953
var performance = windowAlias.performance || windowAlias.mozPerformance || windowAlias.msPerformance || windowAlias.webkitPerformance;
@@ -1013,7 +1014,7 @@
10131014

10141015
/**
10151016
* Get data for Optimizely "lite" contexts - active experiments on current page
1016-
*
1017+
*
10171018
* @returns Array content of lite optimizely lite context
10181019
*/
10191020
function getOptimizelySummary() {
@@ -1035,7 +1036,7 @@
10351036

10361037
/**
10371038
* Get data for OptimizelyX contexts - active experiments on current page
1038-
*
1039+
*
10391040
* @returns Array content of lite optimizely lite context
10401041
*/
10411042
function getOptimizelyXSummary() {
@@ -1458,7 +1459,7 @@
14581459
purify(customReferrer || configReferrerUrl),
14591460
addCommonContexts(finalizeContexts(context, contextCallback)),
14601461
tstamp);
1461-
1462+
14621463
// Send ping (to log that user has stayed on page)
14631464
var now = new Date();
14641465
if (activityTrackingEnabled && !activityTrackingInstalled) {

0 commit comments

Comments
 (0)