if (window.mics && window.mics._call) { const userEventTag = {"site_id":"4312","enable_experimental_features":true,"enable_local_segment_evaluation":true,"enable_installation_id_generation":false,"enable_tcf_v2_for_cookie_matching":true,"enable_goo_matching":true,"enable_apx_matching":true,"enable_id5_id":false,"enable_utiq_mtid":true,"namespace":"orange_web","segment_definition_uri":"/v1/sites/orange_web/segment.js?v=750","custom_configuration":{"segment_evaluator_url":"https://static.mediarithmics.com/tag/2/evaluator.min.js"},"mics_cookie_domain":"orange.fr","mics_cookie_domain_creation_ts":1729150970853,"mics_cookie_domain_last_modified_ts":1729150970853} ; const mumConf = {"channel_id":"4312","active":true,"mics_cookie_domain":"orange.fr","mics_cookie_domain_creation_ts":1729150970853,"mics_cookie_domain_last_modified_ts":1729150970853}; const cmp_ids = [352,308,5,449,247,379,440,10,385,384,340,404,185,417,436,25,14,125,421,46,416,448,316,443,321,376,348,84,353,397,280,61,221,396,411,428,312,292,6,380,439,302,260,28,392,297,424,407,429,21,165,92,229,361,435,329,224,317,388,141,420,403,9,225,77,212,129,371,134,105,2,311,343,237,412,425,430,264,279,444,423,291,59,413,259,27,445,335,236,181,350,382,54,406,113,419,76,7,318,434,303,387,323,213,198,330,345,367,399,306,299,3,438,431,167,35,426,162,374,112,123,355,63,282,414,327,409,441,31,72,386,446,231,450,363,218,104,304,258,351,390,401,171,418,58,433,383,287,235,246,300,447,432,410,168,405,183,422,273,305,242,294,341,79,437,415,332,427,47,200,68,442,369,90,227,354,309,222,364]; const enable_mum_id = JSON.parse(mumConf.active ?? userEventTag.enable_mum_id ?? true); const enable_id5 = JSON.parse(userEventTag.enable_id5_id ?? false); // Restrict from using forbidden registry mics._call("orange_web", "addAllowedRegistry", ['0']); if (enable_id5) { mics._call("orange_web", "addAllowedRegistry", ['4']); } const extra_allowed_registries = []; extra_allowed_registries.forEach(registry => mics._call("orange_web", "addAllowedRegistry", [registry])); const fullLegacyConf = { ...(userEventTag.custom_configuration || {}), "cmp_ids": cmp_ids, "enable_local_segment_evaluation": JSON.parse(userEventTag.enable_local_segment_evaluation ?? 'false'), "segment_evaluator_uri": userEventTag.segment_evaluator_uri, "segment_definition_uri": userEventTag.segment_definition_uri, "enable_apx_matching": enable_mum_id && JSON.parse(userEventTag.enable_apx_matching ?? 'true'), "enable_goo_matching": enable_mum_id && JSON.parse(userEventTag.enable_goo_matching ?? 'true'), "enable_tcf_v2_for_cookie_matching": JSON.parse(userEventTag.enable_tcf_v2_for_cookie_matching ?? 'false'), "enable_mum_id": enable_mum_id, "enable_id5": enable_id5, "namespace": userEventTag.namespace, "site_token": userEventTag.site_token ?? (!userEventTag.dat_token ? "orange_web" : undefined), "dat_token": userEventTag.dat_token ?? (!userEventTag.site_token ? "orange_web" : undefined), "device_id_registry_token_to_id_map": userEventTag.device_id_registry_token_to_id_map ?? {}, "mics_cookie_domain": userEventTag.mics_cookie_domain, "mics_cookie_domain_creation_ts": userEventTag.mics_cookie_domain_creation_ts, "mics_cookie_domain_last_modified_ts": userEventTag.mics_cookie_domain_last_modified_ts, }; mics._call("orange_web", 'setConfig', [fullLegacyConf]); const mumIdConf = {"channel_id":"4312","active":true,"mics_cookie_domain":"orange.fr","mics_cookie_domain_creation_ts":1729150970853,"mics_cookie_domain_last_modified_ts":1729150970853}; if (JSON.parse(mumIdConf.active ?? 'true')) { mics._call("orange_web", "addAllowedRegistry", ["mum"]); } else { mics._call("orange_web", "deleteAdvertisingCookie", ["vid"]); } const installationIdConfiguration = {"channel_id":"4312","device_id_registry_id":null,"device_id_registry_token":null,"active":false} ; if (installationIdConfiguration.device_id_registry_token) { if (JSON.parse(installationIdConfiguration.active ?? 'false')) { mics._call("orange_web", "addAllowedRegistry", [installationIdConfiguration.device_id_registry_token]); mics._call( "orange_web", 'upsertAdvertisingCookie', ["ins", installationIdConfiguration.device_id_registry_token, "aM2M4OGJmN2MtMDVjYy00OWNmLTliODItODExZTFiMDZiZDVl"] ); } else { mics._call("orange_web", "deleteAdvertisingCookie", [installationIdConfiguration.device_id_registry_token]); } } const firstIdConf = {"channel_id":"4312","active":false}; if (JSON.parse(firstIdConf.active ?? 'false')) { mics._call("orange_web", "addAllowedRegistry", ['first-id']); function readCookie(name) { const cookies = window.document.cookie.split(';'); for (let i = 0; i < cookies.length; i++) { const cookie = cookies[i].replace(/ /g, '').split('='); if (cookie[0] === name) { return cookie[1]; } } return undefined; } let firstIdValue; if (window.FIRSTID !== undefined && window.FIRSTID.getId !== undefined) { window.mics._call("orange_web", "lodDebug", ['FIRSTID present, use FIRSTID.getId()']); firstIdValue = window.FIRSTID.getId(); } else if (window.firstId !== undefined && window.firstId.cookieName !== undefined) { window.mics._call("orange_web", "lodDebug", ['only firstId conf present, use firstId.cookieName']); firstIdValue = readCookie(window.firstId.cookieName); } else { window.mics._call("orange_web", "lodDebug", ['Nothing found, read cookie firstid']); firstIdValue = readCookie("firstid"); } window.mics._call("orange_web", "lodDebug", ['firstIdValue = ' + firstIdValue]); if (firstIdValue) { window.mics._call("orange_web", "_addIdentifier", ['USER_AGENT', {"$user_agent_id": `net:first-id:${firstIdValue}`}]); } } let utiqMtidConf = {"channel_id":"4312","active":true,"compartment_id":"20","compartment_token":"utiq-martechpass"}; if (JSON.parse(utiqMtidConf.active ?? 'false')) { function parseUtiqPass() { let parsedData = {}; try { const utiqPass = window.localStorage.utiqPass ?? "{}"; parsedData = JSON.parse(utiqPass); } catch (error) { window.console.error("Error parsing localStorage.utiqPass", error); } return parsedData; } function getExpirationDate() { let expirationDate = undefined; try { const utiqPass = parseUtiqPass(); expirationDate = Date.parse(utiqPass?.ids?.source?.connectId?.ttl); if (isNaN(expirationDate)) { expirationDate = undefined; } } catch (error) { window.console.error("Error parsing utiqPass?.ids?.source?.connectId?.ttl ", error); expirationDate = undefined; } return expirationDate; } function getMtidCategory(mtid) { const utiqPass = parseUtiqPass(); const utiqIdGraph = utiqPass?.ids?.source?.connectId?.idGraph || []; const category = utiqIdGraph.find(entry => entry.mtid === mtid)?.category; return category; } function getIdGraphEntry(entryName) { const entryOrError = window.Utiq.API.getIdGraphEntry(entryName); if (entryOrError.indexOf(' ') >= 0) { throw new Error(entryOrError); } return entryOrError; } function addUtiqIdentifier(mtid) { const expirationDate = getExpirationDate(); const mtidCategory = getMtidCategory(mtid); let account = { "$user_account_id": mtid, "$compartment_token": utiqMtidConf.compartment_token }; if (expirationDate) { account.$expiration_ts = expirationDate; } if (mtidCategory === "mobile") { window.mics._call("orange_web", "_addIdentifier", ['USER_ACCOUNT', account]); } else { window.console.warn(`Utiq mtid is not of mobile category (=${mtidCategory}), not adding to identifiers`); } } let utiqFetchingIntervalId; function checkForUtiq() { if (window.Utiq && window.Utiq.API && window.Utiq.API.getIdGraphEntry) { try { addUtiqIdentifier(getIdGraphEntry('mtid')); } catch (e) { window.console.error('Error while fetching mtid from Utiq', e); } finally { if (utiqFetchingIntervalId) { clearInterval(utiqFetchingIntervalId); } } } } if (window.setInterval && window.setTimeout) { utiqFetchingIntervalId = setInterval(checkForUtiq, 500); setTimeout(() => { clearInterval(utiqFetchingIntervalId); }, 30000); } else { checkForUtiq(); } }; mics._call("orange_web", 'markConfigAsLoaded', []); }