Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rename cookie to adSlot and do some A/B testing

  • Loading branch information...
commit dc9407e591be25470ea4a81fe22a863a652b3764 1 parent 00c66ec
@jeffkreeftmeijer authored
Showing with 7 additions and 8 deletions.
  1. +7 −8 _layouts/default.html
View
15 _layouts/default.html
@@ -45,23 +45,21 @@
var cookies = {};
var pairs = document.cookie.split('; ')
- var cookie;
+ var adSlot;
for(i in pairs) {
pair = pairs[i].split('=');
if(pair[0] == 'jk-ad') {
- cookie = pair[1];
+ adSlot = pair[1];
}
}
- if(!cookie) {
- cookie = new Date().getSeconds() % 2;
- document.cookie = 'jk-ad=' + cookie;
+ if(!adSlot) {
+ adSlot = new Date().getSeconds() % 2;
+ document.cookie = 'jk-ad=' + adSlot;
}
- console.log(cookie);
-
- document.write(ads[cookie]);
+ document.write(ads[adSlot]);
</script>
</div>
@@ -77,6 +75,7 @@
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12888762-1']);
_gaq.push(['_trackPageview']);
+ _gaq.push(['_setCustomVar', 1, 'adSlot', adSlot == 1 ? 'Carbon ads' : 'Influads']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
Please sign in to comment.
Something went wrong with that request. Please try again.