Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const originalSrc = storage.getItem(originalSourceKey, { storage: config.storage })
if (originalSrc) {
return parsePipeString(originalSrc)
}
// 2. then try __utmz cookie
const utmzCookie = getCookie('__utmz')
if (utmzCookie) {
const parsedCookie = parsePipeString(utmzCookie)
if (parsedCookie) {
setOriginalSource(parsedCookie, config)
return parsedCookie
}
}
// 3. Then try referrer url and utm params
const ref = (inBrowser) ? (referrer || document.referrer) : ''
const refData = parseReferrer(ref)
setOriginalSource(refData, config)
return refData
}