Created
October 30, 2024 19:29
-
-
Save robisatthefunction/7069c7089577c253fe9ee766f75cf033 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getCookie(name){ | |
var match = document.cookie.match(name + '=([^;]*)'); | |
return match ? match[1] : undefined; | |
} | |
var tealium_cookie = getCookie('utag_main'); | |
function setTealiumIds(tealium_cookie) { | |
if(!!tealium_cookie){ | |
var tealium_vid = tealium_cookie.split('v_id:')[1].split('$')[0]; | |
var tealium_sid = tealium_cookie.split('ses_id:')[1].split('%')[0]; | |
window.optimizely = window.optimizely || []; | |
window.optimizely.push({ | |
"type": "user", | |
"attributes": { | |
"tealium_vid": tealium_vid | |
} | |
}); | |
window.optimizely = window.optimizely || []; | |
window.optimizely.push({ | |
"type": "user", | |
"attributes": { | |
"tealium_sid": tealium_sid | |
} | |
}); | |
} | |
} | |
setTealiumIds(tealium_cookie); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment