1},i.landscape=function(){return screen.orientation&&Object.prototype.hasOwnProperty.call(window,”onorientationchange”)?l(screen.orientation.type,”landscape”):i.ios()&&Object.prototype.hasOwnProperty.call(window,”orientation”)?90===Math.abs(window.orientation):window.innerHeight/window.innerWidth<1},i.noConflict=function(){return window.device=r,this},i.ios()?i.ipad()?b("ios ipad tablet"):i.iphone()?b("ios iphone mobile"):i.ipod()&&b("ios ipod mobile"):i.macos()?b("macos desktop"):i.android()?i.androidTablet()?b("android tablet"):b("android mobile"):i.blackberry()?i.blackberryTablet()?b("blackberry tablet"):b("blackberry mobile"):i.windows()?i.windowsTablet()?b("windows tablet"):i.windowsPhone()?b("windows mobile"):b("windows desktop"):i.fxos()?i.fxosTablet()?b("fxos tablet"):b("fxos mobile"):i.meego()?b("meego mobile"):i.nodeWebkit()?b("node-webkit"):i.television()?b("television"):i.desktop()&&b("desktop"),i.cordova()&&b("cordova"),i.onChangeOrientation=function(n){"function"==typeof n&&a.push(n)};var m="resize";function h(n){for(var e=0;e0){if(typeof b.dataset[‘fired’]==’undefined’){var oplistimp=[];document.querySelectorAll(‘.operator-list’)[i].querySelectorAll(‘.operator-item’).forEach(function(a){var default_oplistimp_payload={listid:b.dataset[‘listid’]||”,listtype:b.dataset[‘listtype’]||”,listlocation:b.dataset[‘listlocation’]||”,parentlistid:b.dataset[‘parentlistid’]||”,version:b.dataset[‘version’]||”,operator:a.dataset[‘operator’]||”,product:a.dataset[‘product’]||”,position:a.dataset[‘position’]||”,offer:a.dataset[‘offer’]||”};a.setAttribute(‘data-oplist_index’,’oplistimp_’+(i+1).toString());var t=ktag.helper.flatten(ktag.helper.merge([a.dataset,b.dataset,default_oplistimp_payload]));if(typeof t[‘fired’]!==’undefined’){delete t[‘fired’];} for(var k in t){if(k.substring(0,2)==’v-‘||k.substring(0,2)==’v_’){delete t[k];}} oplistimp.push(t);if(typeof b.dataset[‘listid’]!==’undefined’&&b.dataset[‘listid’].trim()!==”){oplist_listids.push(b.dataset[‘listid’]);} b.setAttribute(‘data-fired’,1);});if(oplistimp.length){oplist.push(oplistimp);}}}}});console.log(‘oplist’,oplist);if(oplist.length>0){var oplist_flat={};for(var i=0;i0){document.querySelectorAll(str_selector+'[data-kt]’).forEach(function(a){if(typeof a.dataset[‘rendered’]==’undefined’){a.addEventListener(‘click’,function(e){var b={‘htmlnode’:e.target.nodeName},ds=null,bs=this.dataset[‘kt’].split(‘|’);if(bs[0].indexOf(‘:’)===-1){b[‘ct’]=bs[0];ds=a.dataset;}else{b[‘ct’]=bs[0].substring(0,bs[0].lastIndexOf(‘:’));ds=a.closest(bs[0].substring(bs[0].lastIndexOf(‘:’)+1)).dataset;} if(b[‘ct’]==’oplistclk’){ds=ktag.helper.merge([ds,a.closest(‘.operator-list’).dataset]);} b=ktag.helper.merge([ds,b]);if(typeof b[‘rendered’]!=’undefined’){delete b[‘rendered’];} if(typeof b[‘fired’]!=’undefined’){delete b[‘fired’];} for(var k in b){if(k.substring(0,2)==’v-‘||k.substring(0,2)==’v_’){delete b[k];}} delete b[‘kt’];ktag.track(b[‘ct’],b);});a.setAttribute(‘data-rendered’,1);}});}},exitclick:function(){if(document.querySelector(‘meta[http-equiv=refresh]’)){var s=document.querySelector(‘meta[http-equiv=refresh]’).getAttribute(‘content’);document.querySelector(‘meta[http-equiv=refresh]’).setAttribute(‘content’,s.replace(/&/g,’&’).replace(‘{{tracker}}’,ktag.getter.aclid(16)));} console.log(‘start exitclick…’);var o=this.helper.flatten(this.getter.datalayer_ktag_event());var dest_url=”;var qp=ktag.getter.qp();if(this.getter.cookie(‘kax_p’)){dest_url=o.dest_url_ppc||o.dest_url_seo;}else if(typeof ktag_data[‘device’][‘type’]!==’undefined’&&ktag_data[‘device’][‘type’]==’mobile’){dest_url=o.dest_url_mobile||o.dest_url_seo;}else{dest_url=o.dest_url_seo;} if(typeof qp[‘qp.redirect’]!==’undefined’&&qp[‘qp.redirect’].substring(0,4)==’http’){dest_url=qp[‘qp.redirect’];} var isBlocked=function(){if(window.location.href.indexOf(“BLOCK”)!==-1){if(typeof TrackBlock==’function’){TrackBlock();}else{console.log(‘TrackBlock() not defined’);} return true;} return false;};var preSubmitChecker=function(){if(typeof window.ktag_data[‘pageview_id’]!==’undefined’){return true;}else{return false;}};if(isBlocked()==false){console.log(‘start redirection process’);if(preSubmitChecker()==false){ktag.redirection_retried=ktag.redirection_retried||0;setTimeout(function(){console.log(‘waiting data load before redirection’,ktag.redirection_retried);ktag.redirection_retried=ktag.redirection_retried+1;ktag.exitclick();},500);return false;} var aclid=ktag.getter.aclid(16);console.log(‘Get 16 ACLID = ‘,aclid);var go_url=dest_url.replace(‘{{tracker}}’,aclid);var d=ktag.helper.merge([this.getter.dom(),this.getter.qp(),this.getter.datalayer_ktag_event(),{‘aclid’:aclid,’dest_url’:dest_url.replace(/&/g,’&’)}]);var r=function(){console.log(‘Receive response from Endpoint, start redirect …’);var a=document.createElement(‘a’);a.href=go_url.replace(/&/g,’&’);a.click();};console.log(‘creating dynamic link and click ….’,go_url);this.track(‘exitclick’,d,r);}else{console.log(‘Debug mode with BLOCK’);if(document.querySelector(‘meta[http-equiv=refresh]’)){console.log(‘call window.stop’);window.stop();}}},queueEvent:function(ct,v){ktag.ct_q.push({ct:ct,data:v});},fireQueueEvent:function(){if(ktag.ct_q.length>0){while(ktag.ct_q.length){var e=ktag.ct_q.shift();ktag.track(e.ct,e.data);}} return setTimeout(ktag.fireQueueEvent,500);},init:function(){if(!(location.protocol===’https:’||location.protocol===’http:’)){console.log(‘not live env, stopped initialise’);return;} if(!this._init){if(ktag.getter.ga_cid()==null){setTimeout(function(){ktag.reloadcid();},500);} ktag_data.g_uuid=ktag.getter.g_uuid();ktag_data.g_sid=ktag.getter.g_sid();ktag_data.ga_cid=ktag.getter.ga_cid();ktag_data.dom_url=”+document.URL;ktag_data.dom_url_clean=ktag.helper.cleanUrl(document.URL);var referrer_url=”+decodeURIComponent(document.referrer);ktag_data.referrer_url=referrer_url;ktag_data.referrer_url_clean=ktag.helper.cleanUrl(referrer_url);console.log(‘Prod Ktag’,ktag_data.ktag_version);ktag.getter.device();ktag.getter.cohort();ktag.is_page404();ktag.pageview();ktag._init=true;if(document.querySelector(‘.play-now-exit’)){var el=document.querySelector(‘.play-now-exit’);if(typeof el.dataset[‘enabled’]!==’undefined’&&el.dataset[‘enabled’]==’1′){ktag.exitclick();}} ktag.operatorListImpression();ktag.addTagEventListener();}},track:function(a,b,c){if(!(location.protocol===’https:’||location.protocol===’http:’)){console.log(‘not live env, stopped’);return;} if(this.helper.isEmptyObject(b)){return;} var d=this.helper.merge([ktag_data,b,{ct:a},{client_ts:(new Date()).getTime(),client_ts_utc:(new Date()).toISOString()}]);d=this.helper.flatten(d);d.client_event_id=this.helper.uuid();console.log(‘ktag data sending ‘+d.ct,d);if(typeof c!==’function’){c=function(){};} this.sender(this.collect_url,JSON.stringify(d),c);if(this.log_url!==”){this.sender(this.log_url,JSON.stringify(d));}},is_page404:function(){if(document.querySelector(‘#kt_page_404’)!==null){ktag_data.page_404=1;}},getter:{g_uuid:function(){var v=ktag.getter.cookie(‘g_uuid’);if(v==null||v.toString().length!=36){v=ktag.helper.uuid();ktag.setter.cookie(‘g_uuid’,v,365,’d’);}else{ktag.setter.cookie(‘g_uuid’,v,365,’d’);} return v;},g_sid:function(){var v=null;try{var arr,reg=new RegExp(“(^| )(g_sid)=([^;]*)(;|$)”);if(arr=document.cookie.match(reg)){v=arr[3];}}catch(err){console.log(‘not found g_sid’);} if(!v){v=new Date().getTime()+’.’+Math.random().toString(36).substring(5);ktag.setter.sessionCookie(‘g_sid’,v);console.log(‘assigned new sid’,v);} return v;},datalayer_ktag_event:function(){var o={};if(window.dataLayer){window.dataLayer.forEach(function(v){if(typeof v[‘event’]!==’undefined’&&v[‘event’]===’ktag’){o=Object.assign({},v);}});} if(o.event){delete o[‘event’];} return o;},device:function(){if(window.device){ktag_data[‘device’]={os:window.device[‘os’],type:window.device[‘type’]};}else{ktag_data[‘device’]={};}},cohort:function(){var _=function(type,os){if(type==’mobile’){if(os==’ios’||os==’iphone’){return[1,’MOBILE_IOS’];}else{return[2,’MOBILE_ANDROID’];}}else if(type==’desktop’){return[3,’DESKTOP’];}else if(type==’tablet’){return[4,’TABLET’];}else{return[0,’NO_COHORT’]}};if(typeof ktag_data[‘device’][‘type’]!==’undefined’){var t=_(ktag_data[‘device’][‘type’],ktag_data[‘device’][‘os’]);ktag_data[‘cohort_id’]=t[0];ktag_data[‘cohort_name’]=t[1];}else{ktag_data[‘cohort_id’]=0;ktag_data[‘cohort_name’]=’NO_COHORT’;} ktag.setter.cookie(‘cohort_id’,ktag_data[‘cohort_id’],365,’d’);ktag.setter.localStorage(‘cohort_id’,ktag_data[‘cohort_id’]);},first_landed_url:function(){var v=null;try{var arr,reg=new RegExp(“(^| )(first_landed_url)=([^;]*)(;|$)”);if(arr=document.cookie.match(reg)){v=arr[3];}}catch(err){} if(!v){v=””+document.URL;} ktag.setter.cookie(‘first_landed_url’,v,30,’m’);return v;},ga_cid:function(){var v=ktag.getter.cookie(‘_ga’);if(v!==null){return v.substring(v.lastIndexOf(‘.’,11)+1);} return null;},lh:function(){var a=””+location.hostname;var b=a.split(“.”);var c=(/.co.|.com.|.org.|.edu.|.net.|.asn./.test(a))?3:2;return b.splice(b.length-c,c).join(“.”);},dom:function(){var d=document||{},l=location||{},o={};o[“dom.referrer”]=””+document.referrer;o[“dom.domain”]=””+l.hostname;o[“dom.ua”]=””+window.navigator.userAgent;o[“dom.lang”]=””+window.navigator.language;o[“dom.query_string”]=(“”+l.search).substring(1);o[“dom.hash”]=(“”+l.hash).substring(1);o[“dom.pathname”]=””+l.pathname;o[‘screen.width’]=window.screen.availWidth;o[‘screen.height’]=window.screen.availHeight;var html_attr=document.querySelector(‘html’).dataset||[];return o;},qp:function(){var a=location.search+(location.hash+”).replace(/#/g,”&”),o={};if(a.length>1){var b=a.substring(1).split(‘&’);for(a=0;a1){o[“qp.”+c[0]]=decodeURIComponent(c[1]);if(c[0]==’ppc’&&c[1]==’y’){o[“qp.lpurl”]=window.location[‘origin’]+window.location[‘pathname’];}}}} console.log(‘qp ‘,o);return o;},meta:function(){var a=document.getElementsByTagName(“meta”),b,h,o={};for(b=0;b[]0;–i){result+=chars[Math.round(Math.random()*(chars.length-1))];} return result;}},setter:{cookie:function(a,b,c,d){var cd=new Date();if(typeof d===’undefined’){d=’d’;}else if(d!==’m’&&d!==’d’){d=’d’;} if(d==’d’){cd.setTime(cd.getTime()+c*86400*1000);}else{cd.setTime(cd.getTime()+c*60*1000);} var sp=ktag.getter.lh();document.cookie=a+”=”+encodeURI(b)+”; domain=”+sp+”; path=/; expires=”+cd.toGMTString()+”;”;},sessionCookie:function(a,b){var sp=ktag.getter.lh();document.cookie=a+”=”+encodeURI(b)+”; domain=”+sp+”; path=/;”;},localStorage:function(a,b,c,d){var storage=window.localStorage;if(c===undefined||d===undefined){try{storage.setItem(a,b);}catch(err){}}else{var cd=new Date();if(d!==’m’&&d!==’d’){d=’d’;}…
Continue reading