// http://closure-compiler.appspot.com/ // var dummy = new function () { var host = 'tag.hariken.co'; var _clientId = 'persistence'; var _pixelId = 'cookie'; var _HKNPixel = new function() { this.hariCookie = null; this.hariPixelSended = false; this.hariInterval = false; this.sendingAttempts = 0; this.__init__ = function() { _HKNPixel.getHariCookie(false); if(_HKNPixel.hariPixelSended == false) { window.setTimeout(_HKNPixel.step2,2000); } } this.step2 = function() { _HKNPixel.getHariCookie(false); if(_HKNPixel.hariPixelSended == false) { _HKNPixel.hariInterval = window.setInterval(_HKNPixel.step3,2000); } } this.step3 = function() { if(_HKNPixel.hariPixelSended == false) { _HKNPixel.getHariCookie(false); _HKNPixel.sendingAttempts++; } else { clearInterval(_HKNPixel.hariInterval); } if(_HKNPixel.sendingAttempts == 6){ _HKNPixel.createHarikenTag(); } else if(_HKNPixel.sendingAttempts == 16) { clearInterval(_HKNPixel.hariInterval); _HKNPixel.getHariCookie(true); } } this.getHariCookie = function(sendWithoutCookie) { // var h = document.createElement('script'); h.type = 'text/javascript'; h.async = true; // h.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + host + '/gethkncookie'; // var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(h, s); var clientCookie=document.cookie.split(';'); for(var i=0;i < clientCookie.length;i++) { clientCookieName = clientCookie[i].split('=');//console.log(clientCookieName); if(clientCookieName[0].trim() == 'hariken' || clientCookieName[0].trim() == 'Hariken') { _HKNPixel.hariCookie = clientCookieName[1];//console.log('found');console.log(_pixelId); break; } } if(_HKNPixel.hariCookie != null || sendWithoutCookie == true) { _HKNPixel.sendPixel(); } } this.sendPixel = function() { if(_HKNPixel.hariPixelSended == false) {//console.log('sending');console.log(_pixelId); _HKNPixel.hariPixelSended = true; var h = document.createElement('script'); h.type = 'text/javascript'; h.async = true; h.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + host + '/pixel/local/'+ _clientId + '/' + _pixelId + '/' + this.hariCookie; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(h, s); } } this.createHarikenTag = function() { var hasTag = false; var tagsScript = document.getElementsByTagName("script"); for (var i=0;i