
AE.namespace('AE.tool.omniTracking');AE.tool.omniTracking=function(){this.defConfig={PPC:{PPCSrc:['google','google-gs','google-ggs','google-itp','overture','yahoouk','yahooau','yahoohk','yahootw','yahookr','yahoofr','yahoode','yahoobr','yahooin','msn','gowholesale','facebook'],needCheck:['albag','albst'],needSplit:{albag:['landingPageType','countryNameWithKeywords','PPCGroupName','keywordType']}},IBDM:{needCheck:['src'],needSplit:{src:['region','campaignNumber','element','serial']}}}}
AE.tool.omniTracking.prototype=YL.merge(AE.tool.omniTracking.prototype,{_P_DATA:{_type:undefined,_campaign:undefined,_result:{}},checkIsNeed:function(){if(s.getQueryParam('s_kwcid')){return true;}else{return false;}},checkIsIBDM:function(){if(s.getQueryParam('src')){var _params=s.getQueryParam('src');var reg=/ibdm_d[\d]+p[\d]+e[\d]+r[\d]+/;if(reg.test(_params)){this._P_DATA['_type']='ibdm';this._P_DATA['_campaign']=s.getQueryParam('src');return true;}else{return false;}}else{return'omnitrue';}},checkIsPPC:function(){if(s.getQueryParam('src')){var _params=s.getQueryParam('src').toLowerCase();var isPPC=false;for(var i=0,j=this.defConfig['PPC']['PPCSrc'].length;i<j;i=i+1){if(_params===this.defConfig['PPC']['PPCSrc'][i]){this._P_DATA['_campaign']=s.getQueryParam('s_kwcid');isPPC=true;}}
if(isPPC){this._P_DATA['_type']='ppc';return true;}else{return false;}}},checkWorkShop:function(){if(this.checkIsNeed()){if(this.checkIsPPC()){return this.splitAndCheckParams();}else{return false;}}else{if(this.checkIsIBDM()){if(this.checkIsIBDM()=='omniture'){}else{return this.splitAndCheckParams();}}else{return false;}}},splitAndCheckParams:function(){switch(this._P_DATA['_type']){case'ibdm':var needCheck=this.defConfig['IBDM']['needCheck'];var needSplit=this.defConfig['IBDM']['needSplit'];var temp=s.getQueryParam('src');var tempStr='';var string=temp.split('_')[1];var reg=/[dper]+/g;var tempStr=string.replace(reg,';').substring(1);var params=tempStr.split(';');for(var i=0,j=params.length;i<j;i=i+1){this._P_DATA['_result'][needSplit['src'][i]]=params[i];}
return true;break;case'ppc':var needCheck=this.defConfig['PPC']['needCheck'];var needSplit=this.defConfig['PPC']['needSplit'];for(var i=0,j=needCheck.length;i<j;i=i+1){for(var key in needSplit){if(needCheck[i]==key){var temp=s.getQueryParam(needCheck[i]);if(this.checkString(temp)){var params=temp.toLowerCase().split('_');var tempStr='';for(var o=0,p=params.length;o<p;o=o+1){this._P_DATA['_result'][needSplit[key][o]]=params[o];}}}else{var temp=s.getQueryParam(needCheck[i]);if(this.checkString(temp)){this._P_DATA['_result'][needCheck[i]]=temp;}}}}
return true;break;default:return false;break;}},getCampaignID:function(){return this._P_DATA['_campaign'];},getType:function(){return this._P_DATA['_type'];},getParameters:function(){return this._P_DATA['_result'];},checkString:function(str){var legality_reg=/[^\uFFFE\uFFFF\u0000]+/;var common_reg=/[\w|[\?#&_\-\+=]]*/;if(legality_reg.test(str)){return common_reg.test(str);}},init:function(config){this.defConfig=YL.merge(this.defConfig,config||{});}});
