Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | 3x 3x 3x 3x 3x 3x 3x 3x 2562x 2562x 2562x 2562x 2562x 3x 2563x 3x 2562x 2562x 2562x 3x 1x 1x 1x 1x 3x 61x 34x 2594x 2562x 2562x 2562x 2560x 34x 3x 2x 2x 2x 3x 63x 63x 2x 61x | import {getConfig} from './config.js' const ADOBE_ORG_ID = '05FF6243578784B37F000101@AdobeOrg' const AUTHENTICATE_STATE = 1 const DEFAULT_DEMDEX_VERSION = '3.3.0' const TIME_BETWEEN_RETRIES = 15 const TIMES_TO_RETRY = 80 const TRACKING_SERVER = 'schibstedspain.d3.sc.omtrdc.net' const SERVERS = { trackingServer: TRACKING_SERVER, trackingServerSecure: TRACKING_SERVER } let mcvid const syncMail = async demdex => { // 1. We try to get the hashed user email from the segment wrapper config let hashedUserEmail = getConfig('hashedUserEmail') // 2. If not available, we try to get the userEmail from config and hash it // we dynamically import the module of hashing to avoid bloating the bundle // if not needed Eif (!hashedUserEmail) { const userEmail = getConfig('userEmail') Iif (userEmail) { hashedUserEmail = await import('./hashEmail.js').then(({hashEmail}) => hashEmail(userEmail) ) } } // 3. if we have at this point a hashed email, then we sync with Demdex Iif (hashedUserEmail) { demdex.setCustomerIDs({ hashed_email: { id: hashedUserEmail, authState: AUTHENTICATE_STATE } }) } } const getDemdex = () => window.Visitor && window.Visitor.getInstance(ADOBE_ORG_ID, SERVERS) const getMarketingCloudVisitorID = demdex => { const mcvid = demdex && demdex.getMarketingCloudVisitorID() syncMail(demdex) return mcvid } const getAdobeVisitorData = () => { const demdex = getDemdex() || {} const {version = DEFAULT_DEMDEX_VERSION} = demdex const {trackingServer} = SERVERS return Promise.resolve({trackingServer, version}) } export const getAdobeMarketingCloudVisitorIdFromWindow = () => { if (mcvid) return Promise.resolve(mcvid) return new Promise(resolve => { function retry(retries) { if (retries === 0) return resolve('') const demdex = getDemdex() mcvid = getMarketingCloudVisitorID(demdex) return mcvid ? resolve(mcvid) : window.setTimeout(() => retry(--retries), TIME_BETWEEN_RETRIES) } retry(TIMES_TO_RETRY) }) } const importVisitorApiAndGetAdobeMCVisitorID = () => import('./adobeVisitorApi.js').then(() => { mcvid = getAdobeMarketingCloudVisitorIdFromWindow() return mcvid }) const getAdobeMCVisitorID = () => { const getCustomAdobeVisitorId = getConfig('getCustomAdobeVisitorId') if (typeof getCustomAdobeVisitorId === 'function') { return getCustomAdobeVisitorId() } return getConfig('importAdobeVisitorId') === true ? importVisitorApiAndGetAdobeMCVisitorID() : getAdobeMarketingCloudVisitorIdFromWindow() } export {getAdobeVisitorData, getAdobeMCVisitorID} |