Skip to content

Commit

Permalink
fix: cookie sidc
Browse files Browse the repository at this point in the history
  • Loading branch information
mayuran-deriv committed Jul 31, 2024
1 parent 05c0725 commit 32bc4b3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions public/scripts/cookie.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
/* utility functions */
const getDomain = () => {
const domain = location.hostname;
const allowed_domains = ["deriv.com" , "binary.sx"];
const allowed_domains = ["deriv.com", "binary.sx"];

if (allowed_domains.includes(domain) && domain.includes("deriv.com")) {
return "deriv.com";
}

return ( allowed_domains.includes(domain) && domain.includes("binary.sx")) ? "binary.sx" : domain;
return allowed_domains.includes(domain) && domain.includes("binary.sx")
? "binary.sx"
: domain;
};

const eraseCookie = (name) => {
Expand Down Expand Up @@ -150,6 +152,13 @@ const shouldOverwrite = (new_utm_data, current_utm_data) => {
"t"
)}; expires=Tue, 19 Jan 9999 03:14:07 UTC; domain=${getDomain()}; path=/; SameSite=None; Secure;`;
}
/* start handling affiliate tracking */
if (searchParams.has("sidc")) {
eraseCookie("affiliate_tracking");
document.cookie = `affiliate_tracking=${searchParams.get(
"sidc"
)}; expires=Tue, 19 Jan 9999 03:14:07 UTC; domain=${getDomain()}; path=/; SameSite=None; Secure;`;
}
/* end handling affiliate tracking */

/* start handling signup device */
Expand Down

0 comments on commit 32bc4b3

Please sign in to comment.