Skip to content

Commit

Permalink
fix: Remove existing Tagular cookie with outdated domain metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
julianajlk committed Nov 18, 2024
1 parent dbdcb31 commit 56ab83b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/cohesion/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ export const getCorrelationID = () => {
paramId = uuidv4();
}

// If the tagular correlation ID cookie was set before we added the change to
// specify the domain, it was automatically added to the current domain.
// Always delete the cookie with the current domain
new Cookies().remove(COOKIE_NAME, { domain: window.location.hostname, path: '/' });

const expirationDate = new Date();
expirationDate.setMinutes(expirationDate.getMinutes() + 30); // 30 mins expiration from now
new Cookies().set(COOKIE_NAME, paramId, { expires: expirationDate, domain: `.${getDomain()}` });
new Cookies().set(COOKIE_NAME, paramId, { expires: expirationDate, domain: `.${getDomain()}`, path: '/' });

return paramId;
};
Expand Down

0 comments on commit 56ab83b

Please sign in to comment.