[]
Homepage | BMJ Mental Health c.split(“=”)) ); for (let key in cookies) { if (cookies[key] === “undefined”) { cookies[key] = undefined; } } return cookies; } function uuidv4() { var d = new Date().getTime(); //Timestamp var d2 = (typeof performance !== “undefined” && performance.now && performance.now() * 1000) || 0; //Time in microseconds since page-load or 0 if unsupported return “xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx”.replace(/[xy]/g, function (c) { var r = Math.random() * 16; //random number between 0 and 16 if (d > 0) { //Use timestamp until depleted r = (d + r) % 16 | 0; d = Math.floor(d / 16); } else { //Use microseconds since page-load if supported r = (d2 + r) % 16 | 0; d2 = Math.floor(d2 / 16); } return (c === “x” ? r : (r & 0x3) | 0x8).toString(16); }); } function handleCookie() { let cookies = parseCookies(); let bmj_uuid = cookies.bmj_uuid; if (!bmj_uuid) { bmj_uuid = uuidv4(); cookies.bmj_uuid = bmj_uuid; } return { bmj_uuid }; } let { bmj_uuid } = handleCookie(); let bmj_ppid = parseCookies().bmj_ppid; const anonMailId = “e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855”; let nonAnonMailId = window.dataLayer.find((item) => item.user)?.user?.mail === anonMailId ? null : window.dataLayer.find((item) => item.user)?.user?.mail; let userId = dataLayer.find((item) => item.user)?.user?.[“data-ics”] ?? (dataLayer.find((item) => item.user)?.user?.mail && nonAnonMailId) ?? bmj_ppid ?? bmj_uuid; document.cookie = “bmj_ppid=” + userId + “; domain=.bmj.com; path=/; max-age=31622400; SameSite=None; Secure”; document.cookie = “bmj_uuid=” + bmj_uuid + “; domain=.bmj.com; path=/; max-age=31622400; SameSite=None; Secure”; var googletag = googletag || { cmd: [] }; googletag.cmd.push(function () { googletag.pubads().setPublisherProvidedId(userId); googletag.enableServices(); }); window.dataLayer.push({ bmj_uuid: bmj_uuid, }); ]]> Validation period: 5/12/2024, 11:53:14 AM – 5/12/2024, 5:53:14 PMLogin
A peer-reviewed open access journal from BMJ that publishes research, reviews and education in mental health, psychiatry and psychology.
