diff --git a/src/cohesion/helpers.js b/src/cohesion/helpers.js index c66c9ae55..de0c30720 100644 --- a/src/cohesion/helpers.js +++ b/src/cohesion/helpers.js @@ -9,6 +9,11 @@ export const getCorrelationID = () => { const COOKIE_NAME = 'tglr_correlation_id'; const PARAM_NAME = 'correlationId'; + // 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: 'payment.edx.org', path: '/' }); + function getDomain() { const { hostname } = window.location; const parts = hostname.split('.'); @@ -29,7 +34,7 @@ export const getCorrelationID = () => { 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; };