Skip to content

Commit 5149c59

Browse files
author
Naveen Valecha
authored
convivial-decision-tree-31282: Fix the storage of the decision tree outcome cookie. (#2)
1 parent 2f982c6 commit 5149c59

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

decision_tree.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -467,11 +467,12 @@ class DecisionTree {
467467
* Track attribute into local storage.
468468
*/
469469
trackAttribute(id) {
470-
const step = document.querySelector('#' + this.config.id + ' #' + id);
470+
let step = document.querySelector('#' + this.config.id + ' #' + id);
471471
// Store the attribute.
472472
if (step != null) {
473-
if (step.hasAttribute('data-cookie')) {
474-
this.cookie(step.attributes['data-cookie'].value);
473+
let stepOutcome = step.getAttribute('data-cookie');
474+
if (stepOutcome !== null) {
475+
this.cookie(stepOutcome.split("=")[0], stepOutcome.split("=")[1]);
475476
}
476477
}
477478
}
@@ -503,7 +504,7 @@ class DecisionTree {
503504
} else {
504505
expires = '';
505506
}
506-
document.cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value) + expires + ' path=/ SameSite=None Secure';
507+
document.cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value) + ';' + expires + ';' + ' path=/; SameSite=None; Secure';
507508
}
508509
}
509510

decision_tree.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)