Skip to content

Commit 1ec645f

Browse files
committed
[sc-8500] prevent storing statsSessionId in cookie
1 parent 1d07fbf commit 1ec645f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,16 @@ var client = function(sitekey, privatekey) {
205205
this.setThrottleTime = function(delay) {this.settings.setThrottleTime(delay);}
206206
this.setStatsSessionId = function(id) {
207207
this.sessionId = id;
208-
this.userTokenInPersonalization = null;
208+
this.userTokenInPersonalization = id;
209+
this.useStatsSessionId = true;
209210
}
210211
this.getStatsSessionId = function() {return this.sessionId;}
211212
this.enableLogicalOperators = function(enableLogicalOperators) {this.settings.enableLogicalOperators(enableLogicalOperators)};
212213
this.setSearchOperator = function(operator) {this.settings.setSearchOperator(operator)};
213214

214215
this.sendStatsEvent = function(type, keyword, data) {
215216

216-
var useUserTokenInCookie = this.userTokenInPersonalization && isPersonalizationTrackingEnabled && isAddSearchCookieConsented;
217+
var useUserTokenInCookie = !this.useStatsSessionId && isPersonalizationTrackingEnabled && isAddSearchCookieConsented;
217218
if (useUserTokenInCookie && !cookie.getCookie(USER_TOKEN_COOKIE_NAME)) {
218219
cookie.setCookie(USER_TOKEN_COOKIE_NAME, this.userTokenInPersonalization, personalizationCookieExpireDays);
219220
}

0 commit comments

Comments
 (0)