Created
September 6, 2017 08:17
-
-
Save tvlooy/bc5f3c5d26703e0e73ba7f624f17c1b1 to your computer and use it in GitHub Desktop.
Retargeting Criteo Sociomantic split
This file contains 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
<script type="text/javascript"> | |
var getCookie = function(name) { | |
var match = document.cookie.match(new RegExp(name + '=([^;]+)')); | |
if (match) return match[1]; | |
} | |
var ab_retarget = getCookie('ab_retarget_v1'); | |
if (ab_retarget == undefined) { | |
if (Math.round(+new Date() / 1000) % 2) { | |
ab_retarget = 'sociomantic'; | |
} else { | |
ab_retarget = 'criteo'; | |
} | |
document.cookie = "ab_retarget_v1=" + ab_retarget + ';path=/'; | |
} | |
dataLayer.push({'ab_retarget': ab_retarget}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment