Last active
June 13, 2016 16:28
-
-
Save bcaudan/bfab026fa2416af9fc48dfacc4a59938 to your computer and use it in GitHub Desktop.
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
<html> | |
<head> | |
<script type="text/javascript"> | |
Math.random(); // jquery | |
if (Math.random() > 0.1) { | |
// excluded | |
log(''); | |
} else { | |
// choose version | |
var totalPercentage = 100; | |
var versionsMatched = [1785, 1786, 1787, 1788]; | |
var random = Math.random() * totalPercentage, | |
threshold = 0, | |
version = null; | |
for (var i = 0; i < versionsMatched.length; i++) { | |
var versionMatched = versionsMatched[i]; | |
threshold += 25; | |
if (random <= threshold) { | |
version = versionMatched; | |
break; | |
} | |
} | |
log('?uxt=' + JSON.stringify([[977, version]])); | |
} | |
function log(params) { | |
var image = new Image(1, 1), | |
imgsrc = 'https://t.content-square.net/log' + params; | |
image.src = imgsrc; | |
image.onerror = function () { | |
document.body.innerHTML = '<h1 id="log">After log</h1>' | |
}; | |
} | |
</script> | |
</head> | |
<h1>Before log</h1> | |
<body> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment