Skip to content

Instantly share code, notes, and snippets.

@tvlooy
Created September 6, 2017 08:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tvlooy/bc5f3c5d26703e0e73ba7f624f17c1b1 to your computer and use it in GitHub Desktop.
Save tvlooy/bc5f3c5d26703e0e73ba7f624f17c1b1 to your computer and use it in GitHub Desktop.
Retargeting Criteo Sociomantic split
<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