(function(){ if(window.SibullaTag) return; SibullaTag = {}; //////////////////////////////////////////////////////////////////////////////// // Config //////////////////////////////////////////////////////////////////////////////// SibullaTag.Config = { //************************************************************************** // Set up Logserver Host //************************************************************************** logServer: {}, defaultLogServer: "", setLogServer: function(customerId, domain){ if (customerId) { this.logServer[customerId] = domain; } else { this.defaultLogServer = domain; } }, getLogServer: function(customerId){ var result = this.logServer[customerId]; return result ? result : this.defaultLogServer; }, //************************************************************************** // 3rdCookie from tag server //************************************************************************** thirdCookieData: {}, setThirdCookieData: function(data){ if(!data) data = '{"si":"", "sn":"", "vi":"", "sibu_vid":"", "exclude":"false"}'; this.thirdCookieData = SibullaTag.Utils.jsonDecode(data); }, getThirdCookieData: function(){ return this.thirdCookieData; }, //************************************************************************** // optout decision | if optout, don't send data to logServer. //************************************************************************** isOptout: function(customerId){ var optout = SibullaTag.Utils.getCookie(customerId + 'optout'); return (optout == 'true'); }, //************************************************************************** // exclude tracking | if exclude, don't send data to logServer. //************************************************************************** isExcluded: function(){ var cookie = this.getThirdCookieData(); if(!('exclude' in cookie)) return false; return (cookie.exclude == 'true'); }, //************************************************************************** // setup onload event //************************************************************************** doneSetOnload: false, setOnloadEvent: function(){ if (this.doneSetOnload) return; this.doneSetOnload = true; var func = function() { if (typeof onStartSibullaTracking == "function") { onStartSibullaTracking(SibullaTag.CustomParam); } }; if( document.readyState == 'complete' ){ window.setTimeout(func, 0); } else { SibullaTag.Event.addEvent(window, "load", func); } }, //************************************************************************** // setup siteurls //************************************************************************** siteUrls: {}, defaultSiteUrls: [], setSiteUrls: function(customerId, urls){ if (customerId) { this.siteUrls[customerId] = urls; } else { this.defaultSiteUrls = urls; } }, getSiteUrls: function(customerId){ var result = this.siteUrls[customerId]; return result ? result : this.defaultSiteUrls; } }; //////////////////////////////////////////////////////////////////////////////// // Browser //////////////////////////////////////////////////////////////////////////////// SibullaTag.Browser = { //************************************************************************** //check opera //************************************************************************** isOpera: function() { var ua = navigator.userAgent.toLowerCase(); return (ua.indexOf("opera") > -1 ? true : false); }, //************************************************************************** // check ie //************************************************************************** isIE: function() { var ua = navigator.userAgent.toLowerCase(); if (this.isOpera()) return false; if (ua.indexOf("msie") > -1) return true; return (ua.indexOf("trident/7.0") > -1 && ua.indexOf(" rv:11.") > -1); }, //************************************************************************** // check safari //************************************************************************** isSafari: function() { var ua = navigator.userAgent.toLowerCase(); return ( (/webkit|khtml/).test(ua) ? true : false ); }, //************************************************************************** // check Firefox //************************************************************************** isFirefox: function() { var ua = navigator.userAgent.toLowerCase(); return( !this.isSafari() && ua.indexOf("gecko") > -1 ? true : false); }, //************************************************************************** // check Android //************************************************************************** isAndroid: function() { var ua = navigator.userAgent.toLowerCase(); return( ua.indexOf("android") > -1 ? true : false); }, //************************************************************************** // check iPad //************************************************************************** isIPad: function() { var ua = navigator.userAgent.toLowerCase(); return( ua.indexOf("ipad") > -1 ? true : false); }, //************************************************************************** // check iPhone //************************************************************************** isIPhone: function() { var ua = navigator.userAgent.toLowerCase(); return( ua.indexOf("iphone") > -1 ? true : false); }, //************************************************************************** // check Smart Phone //************************************************************************** isSmartPhone: function() { return this.isAndroid() || this.isIPad() || this.isIPhone(); } }; //////////////////////////////////////////////////////////////////////////////// // Utils //////////////////////////////////////////////////////////////////////////////// SibullaTag.Utils = { //************************************************************************** // check Array Object //************************************************************************** isArray: function(value) { return Object.prototype.toString.apply(value) === '[object Array]'; }, //************************************************************************** // check Object //************************************************************************** isObject: function(value) { return value !== undefined && value !== null && typeof(value) == 'object' && !this.isArray(value); }, //************************************************************************** // check String //************************************************************************** isString: function(value) { return (typeof(value) === 'string' ? true : false); }, //************************************************************************** // check Numeric //************************************************************************** isNumeric: function(value){ return !isNaN(parseFloat(value)) && isFinite(value); }, //************************************************************************** // check exist in array //************************************************************************** isExistInArray: function(list,element){ var me = this ,flg = false; list = list || []; if(!me.isArray(list)) list = [list]; try{ flg = (list.indexOf(element) >= 0); } catch(e){ for(var i = 0; i < list.length; i++){ if(list[i] === element){ flg = true; break; } }; } return flg; }, //************************************************************************** // get class name //************************************************************************** getObjectClassName: function(value) { var name = Object.prototype.toString.apply( value ); var m = name.match( /\[[^\s]+\s([^\s]+)\]/ ); return m ? m[1] : ''; }, //************************************************************************** // escape Regular expressions //************************************************************************** quoteRegExpString: function(str, delimiter) { // Quote regular expression characters plus an optional character // // version: 1107.2516 // discuss at: http://phpjs.org/functions/preg_quote // + original by: booeyOH // + improved by: Ates Goral (http://magnetiq.com) // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + bugfixed by: Onno Marsman // + improved by: Brett Zamir (http://brett-zamir.me) // * example 1: preg_quote("$40"); // * returns 1: '\$40' // * example 2: preg_quote("*RRRING* Hello?"); // * returns 2: '\*RRRING\* Hello\?' // * example 3: preg_quote("\\.+*?[^]$(){}=!<>|:"); // * returns 3: '\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:' return (str + '').replace(new RegExp('[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\' + (delimiter || '') + '-]', 'g'), '\\$&'); }, //************************************************************************** // padding //************************************************************************** padding: function(n) { return n < 10 ? "0" + n : n; }, //************************************************************************** // use has own //************************************************************************** useHasOwn: function() { !!{}.hasOwnProperty; }, //************************************************************************** // check native json exists or not //************************************************************************** isExistNativeJson: function() { return window.JSON && JSON.toString() == '[object JSON]'; }, //************************************************************************** // json encode string type part //************************************************************************** META_TBL: {"\b": '\\b', "\t": '\\t', "\n": '\\n', "\f": '\\f', "\r": '\\r', '"' : '\\"', "\\": '\\\\' }, jsonEncodeForString: function(s) { if( /["\\\x00-\x1f]/.test(s) ){ return '"' + s.replace(/([\x00-\x1f\\"])/g, function(a, b) { var c = this.META_TBL[ b ]; if( c ){ return c; } c = b.charCodeAt(); return "\\u00" + Math.floor(c / 16).toString(16) + (c % 16).toString(16); }) + '"'; } return '"' + s + '"'; }, //************************************************************************** // json encode array object type part //************************************************************************** jsonEncodeForArray: function(o) { var a = ["["], b, i, l = o.length, v; for (i = 0; i < l; i += 1) { v = o[i]; switch (typeof v) { case "undefined": case "function": case "unknown": break; default: if (b) { a.push(','); } a.push( v === null ? "null" : this.jsonEncode(v) ); b = true; } } a.push("]"); return a.join(""); }, //************************************************************************** // json encode date type part //************************************************************************** jsonEncodeForDate: function(o) { return '"' + o.getFullYear() + "-" + this.padding(o.getMonth() + 1) + "-" + this.padding(o.getDate()) + "T" + this.padding(o.getHours()) + ":" + this.padding(o.getMinutes()) + ":" + this.padding(o.getSeconds()) + '"'; }, //************************************************************************** // json encode //************************************************************************** jsonEncode: function(o) { if( typeof(o) == "undefined" || o === null ){ return "null"; } else if( this.isArray(o) ){ return this.jsonEncodeForArray( o ); } else if( Object.prototype.toString.apply(o) === '[object Date]' ){ return this.jsonEncodeForDate( o ); } else if( typeof(o) == "string" ){ return this.jsonEncodeForString( o ); } else if( typeof(o) == "number" ){ return isFinite( o ) ? String( o ) : "null"; } else if(typeof(o) == "boolean" ){ return String( o ); } else{ var a = ["{"], b, i, v; for (i in o) { if(!this.useHasOwn() || o.hasOwnProperty(i)) { v = o[i]; switch (typeof v) { case "undefined": case "function": case "unknown": break; default: if(b){ a.push(','); } a.push( this.jsonEncode(i), ":", v === null ? "null" : this.jsonEncode(v) ); b = true; } } } a.push("}"); return a.join(""); } }, //************************************************************************** // Decode JSON String //************************************************************************** jsonDecode: function(value) { return this.isExistNativeJson() ? window.JSON.parse(value) : eval('(' + value + ')'); }, //************************************************************************** // Formating String //************************************************************************** stringFormat: function(format) { var args = Array.prototype.slice.call(arguments, 1); return format.replace(/\{(\d+)\}/g, function(m, i){ return args[i]; }); }, //************************************************************************** // String both trim //************************************************************************** trim: function(data) { return data.replace(/^\s+|\s+$/g,""); }, //************************************************************************** // String left only trim //************************************************************************** ltrim: function(data) { return data.replace(/^\s+/,""); }, //************************************************************************** // String right only trim //************************************************************************** rtrim: function(data) { return data.replace(/\s+$/,""); }, //************************************************************************** // url encoding //************************************************************************** urlEncode: function(str) { var s0, i, s, u; s0 = ""; // encoded str for (i = 0; i < str.length; i++){ // scan the source s = str.charAt(i); u = str.charCodeAt(i); // get unicode of the char if (s == " "){s0 += "+";} // SP should be converted to "+" else { if ( u == 0x2a || u == 0x2d || u == 0x2e || u == 0x5f || ((u >= 0x30) && (u <= 0x39)) || ((u >= 0x41) && (u <= 0x5a)) || ((u >= 0x61) && (u <= 0x7a))){ // check for escape s0 = s0 + s; // don't escape } else { // escape if ((u >= 0x0) && (u <= 0x7f)){ // single byte format s = "0"+u.toString(16); s0 += "%"+ s.substr(s.length-2); } else if (u > 0x1fffff){ // quaternary byte format (extended) s0 += "%" + (0xf0 + ((u & 0x1c0000) >> 18)).toString(16); s0 += "%" + (0x80 + ((u & 0x3f000) >> 12)).toString(16); s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16); s0 += "%" + (0x80 + (u & 0x3f)).toString(16); } else if (u > 0x7ff){ // triple byte format s0 += "%" + (0xe0 + ((u & 0xf000) >> 12)).toString(16); s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16); s0 += "%" + (0x80 + (u & 0x3f)).toString(16); } else { // double byte format s0 += "%" + (0xc0 + ((u & 0x7c0) >> 6)).toString(16); s0 += "%" + (0x80 + (u & 0x3f)).toString(16); } } } } return s0; }, //************************************************************************** // Create unique Id //************************************************************************** createUniqId: function(len, chars) { var tbl = chars.split( '' ); var value = ''; for( var i = 0; i < len; i++ ){ value += tbl[ Math.floor(Math.random() * tbl.length) ]; } return value; }, //************************************************************************** // Create random Id //************************************************************************** createRandomId: function(len, chars) { chars = chars || 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; return this.createUniqId( len, chars ); }, //************************************************************************** // Create java servlet like session id //************************************************************************** createSessionId: function() { return this.createUniqId( 32, 'ABCDEF0123456789' ); }, //************************************************************************** // get cookie value //************************************************************************** getCookie: function(cname) { var cookies = document.cookie.toString().split(';'); cname = this.trim(cname.toString()); for(var n in cookies) { if( typeof(cookies[n]) == 'function' ){ continue; } var element = this.ltrim(cookies[n]); var pos = element.indexOf('='); if( pos == -1 ){ continue; } if( element.substring(0, pos) == cname ){ return unescape( element.substring(pos + 1) ); } } return ''; }, //************************************************************************** // create date object by unixtime //************************************************************************** createDateByUnixtime: function(unixTime) { var date = new Date(); date.setTime( unixTime * 1000 ); return date; }, //************************************************************************** // set and replace cookie value //************************************************************************** setCookie: function(cname, value, path, domain, expires, isSecure) { var cookie = this.trim(cname.toString()) + '=' + escape(value) + ';'; cookie += 'path=' + (path ? path : '/') + '; '; if( domain ){ cookie += 'domain=' + domain + '; '; } if( expires && (expires instanceof Date) ){ cookie += 'expires=' + expires.toGMTString() + '; '; } if( expires && (expires instanceof String) ){ cookie += 'expires=' + expires + '; '; } if( isSecure ){ cookie += 'secure'; } document.cookie = cookie; }, //************************************************************************** // get hash exist value //************************************************************************** getHashExistValue: function(values, name, defaultValue) { defaultValue = defaultValue || undefined; return ( name in values ? values[ name ] : defaultValue ); }, //************************************************************************** // get config values //************************************************************************** getConfigValues: function(values, name, separator) { var Utils = SibullaTag.Utils; separator = separator || '.'; var names = name.split( separator ); var size = names.length; for( var i = 0; i < size; i++ ){ values = (names[i] in values ? values[ names[i] ] : undefined); if( Utils.isArray(values) && i < (size - 1) ){ return undefined; } } return values; }, //************************************************************************** // get empty fuction //************************************************************************** emptyFn: function(){} }; //////////////////////////////////////////////////////////////////////////////// // SimpleElementSelector //////////////////////////////////////////////////////////////////////////////// SibullaTag.SimpleElementSelector = { /** * selector * * @access public * @param {String} cond * @param {Array} urls * @returns {Array} */ selector: function(cond, urls) { var Utils = SibullaTag.Utils; var Ses = SibullaTag.SimpleElementSelector; urls = urls || []; urls = Utils.isArray(urls) ? urls : [urls]; for( var n = 0; n < urls.length; n++ ){ if( !(Utils.isObject(urls[n]) && Utils.getObjectClassName(urls[n]).toLowerCase() == 'regexp') ){ urls[n] = new RegExp('^' + Utils.quoteRegExpString(urls[n].toString()) ); } } // //get attributes // result = cond.match( /\[(.+)\]/i ); attrs = {}; if( result ){ var attrCond = result[1] + ','; while( attrCond != '' ){ result = attrCond.match( /^\s*([^\=]+)\s*\=\s*("[^"]*(?:""[^"]*)*"|[^,]*),/ ); if( !result ){ break; } attrName = result[1].replace(/\s/g, ''); attrValue = result[2].replace(/^\s*"/, '').replace(/"\s*$/, ''); attrs[attrName] = attrValue; attrCond = attrCond.substr( result[0].length ); } } // //delete all empty // cond = cond.toString().replace(/\s/g, ''); // //get only tags // var result = cond.match( /^([a-z][^\#\.\=\[\]]*)/i ); var tagName = result ? result[1] : '*'; // //get only classes // result = cond.match( /\.([^\#\.\=\[\]]+)/i ); var className = result ? result[1] : ''; // //get only ids // result = cond.match( /\#([^\#\.\=\[\]]+)/i ); var idName = result ? result[1] : ''; result = cond.match( /\[([^\=\[\]]+)\=([^\=\[\]]+)\]/i ); var attrName = result ? result[1] : ''; var attrValue = result ? result[2] : ''; // //get elements // var records = []; var els = document.getElementsByTagName( tagName ); for( var i = 0; i < els.length; i++ ){ var el = els[i]; if( !Ses.isTargetElement(el, idName, className) ){ continue; } if( urls.length == 0 ){ records.push( el ); continue; } for( var n = 0; n < urls.length; n++ ){ var attrName = ''; switch( tagName.toLowerCase() ){ case 'a': attrName = 'href'; break; case 'form': attrName = 'action'; break; default: break; } var targetUrl = el.getAttribute(attrName); var isMatch = (attrName ? urls[n].test(targetUrl) : true); if( !isMatch ){ break; } records.push( el ); } } return records; }, /** * isTargetElement * * @access private * @param {Element} el * @param {String} idName * @param {String} className * @returns {Boolean} */ isTargetElement: function(el, idName, className) { var Ses = SibullaTag.SimpleElementSelector, Utils = SibullaTag.Utils ; if( idName == '' && className == '' ){ return true; } return ( (idName ? (Ses.getElementId(el) == idName ? true : false) : true) && (className ? Utils.isExistInArray( Ses.getElementClassName(el).split(' '), className ) : true) ); }, /** * getElementClassName * * @access private * @param {Element} el * @returns {String} */ getElementClassName: function(el) { return el.className; }, /** * addElementClassName * * @access private * @param {Element} el * @param {String} cname * @returns {String} */ addElementClassName: function(el,cname) { el.className += ((el.className !== '')? ' ':'') + cname; }, /** * getElementId * * @access private * @param {Element} el * @returns {String} */ getElementId: function(el) { return el.id; } }; //////////////////////////////////////////////////////////////////////////////// // Element //////////////////////////////////////////////////////////////////////////////// SibullaTag.Element = { //************************************************************************** // priavte variable //************************************************************************** iframeId: 'sibulla_iframe', formId: 'sibulla_iframe_form', iframeContentTemplate: '
', imgContentTemplate: '', jsContentTemplate: '', // Set up send URL sendUrls: function(customerId,path){ path = path || 'access21'; var protocol = (location.protocol == "http:")? 'http://': 'https://'; return protocol + SibullaTag.Config.getLogServer(customerId) + '/sibulog/'+path; }, //************************************************************************** // send log data by post method //************************************************************************** sendPostData: function(data) { var customerId = data.id; if(SibullaTag.Config.isOptout(customerId)) return; // write iframe tag var iframe = document.createElement( 'iframe' ); iframe.id = this.iframeId; iframe.setAttribute( 'name', this.iframeId ); iframe.setAttribute( 'src', 'javascript:false' ); iframe.setAttribute( 'width', '1' ); iframe.setAttribute( 'height', '1' ); iframe.setAttribute( 'border', '0' ); iframe.setAttribute( 'frameborder', 'no' ); document.body.appendChild(iframe); // get iframe document var childDoc = ( SibullaTag.Browser.isIE() ? iframe.contentWindow.document : (iframe.contentDocument || window.frames[this.iframeId].document) ); // write form tag var protocol = location.protocol; var sendUrl = this.sendUrls(customerId); var content = SibullaTag.Utils.stringFormat( this.iframeContentTemplate, this.formId, this.formId, sendUrl, 'post' ); childDoc.open(); childDoc.write( content ); childDoc.close(); // get form element and submit var childForms = childDoc.getElementsByName( this.formId ); this.writeHiddenData( childDoc, childForms[0], data ); childForms[0].submit(); //remove iframe( 500msec later) var tId = window.setTimeout( function(){ document.body.removeChild( iframe ); try{ window.clearTimeout( tId ); } catch(e){ ; } }, 500 ); }, //************************************************************************** // session data by first party cookies //************************************************************************** setupFirstPartyCookie: function(data) { var now = new Date(); var id = data['id'], sessId = SibullaTag.Utils.getCookie( id + '_si' ), visitId = SibullaTag.Utils.getCookie( id + '_vi' ), globalVId = SibullaTag.Utils.getCookie( 'sibu_vid' ), sessNum = SibullaTag.Utils.getCookie( id + '_sessnum' ), sessExpire = SibullaTag.Utils.getCookie( id + '_sessexpire' ); var expireTime = null; var isCreateSession = false, isCreateVisitId = false, isCreateSessNum = false; // //get session expire time // try{ expireTime = SibullaTag.Utils.createDateByUnixtime( sessExpire ? parseInt(sessExpire) / 1000 : now.getTime() / 1000 ); } catch(e){ expireTime = new Date(); } // //create session // if( now.getTime() >= expireTime.getTime() ){ sessId = SibullaTag.Utils.createSessionId(); isCreateSession = true; } expireTime.setTime( now.getTime() + (30 * 60 * 1000) ); // //create visit // if( !globalVId ){ globalVId = visitId ? visitId : SibullaTag.Utils.createRandomId( 13 ).toUpperCase(); isCreateVisitId = true; } // //create visit num // if(SibullaTag.Utils.isNumeric(sessNum)){ sessNum = parseInt(sessNum); if( !sessNum ){ isCreateSessNum = true; sessNum = 1; } else { sessNum += ( isCreateSession ? 1 : 0 ); } } else { isCreateSessNum = true; sessNum = 1; } SibullaTag.Utils.setCookie( id + '_sessexpire', expireTime.getTime() ); if( isCreateSession ){ SibullaTag.Utils.setCookie( id + '_si', sessId ); } if( isCreateSession || isCreateVisitId ){ var expire = SibullaTag.Utils.createDateByUnixtime( (now.getTime() / 1000) + (90 * 24 * 60 * 60) ); SibullaTag.Utils.setCookie( 'sibu_vid', globalVId, null, null, expire ); if( visitId && visitId != globalVId ){ SibullaTag.Utils.setCookie( id + '_vi', visitId, null, null, expire ); } } if( isCreateSession || isCreateSessNum ){ var expire = SibullaTag.Utils.createDateByUnixtime( (now.getTime() / 1000) + (90 * 24 * 60 * 60) ); SibullaTag.Utils.setCookie( id + '_sessnum', sessNum, null, null, expire ); } data['vi'] = visitId; data['sibu_vid'] = globalVId; data['si'] = sessId; data['sn'] = sessNum; return data; }, //************************************************************************** // send log data by get method //************************************************************************** sendGetData: function(data, objImg) { var customerId = data.id; if(SibullaTag.Config.isOptout(customerId)) return; var protocol = location.protocol; var sendUrl = this.sendUrls(customerId); // //setup first party cookie for smart phone. // if( SibullaTag.Browser.isSmartPhone() ){ data = this.setupFirstPartyCookie( data ); } sendUrl += this.createSendGetUrl(data, objImg); // //create and send log data // if (objImg) { objImg.src = sendUrl; } else { this.createScriptElement(document, document.getElementsByTagName("head")[0], sendUrl); } }, //************************************************************************** // create send url for get method in correct order //************************************************************************** createSendGetUrl: function(data, objImg) { var params = new Array(), customerId = data.id, sendUrl = this.sendUrls(customerId), cdata = SibullaTag.Config.getThirdCookieData(); // set up params params.push( 'id=' + data['id'] ); if( SibullaTag.Browser.isSmartPhone() ) { params.push( 'si=' + data['si'] ); params.push( 'sn=' + data['sn'] ); if (data['vi']) params.push( 'vi=' + data['vi'] ); params.push( 'gvi=' + data['sibu_vid'] ); } params.push( 're=1' ); params.push( 'js=' + ((objImg)? '': '1')); if (SibullaTag.Config.isExcluded()) { params.push( 'ef=1' ); } if( 'URL' in data ) params.push( 'URL=' + data['URL'] ); if( 'REFERER' in data ) params.push( 'REFERER=' + data['REFERER'] ); if( 'ec' in data ) params.push( 'ec=' + data['ec'] ); if( 'un' in data ) params.push( 'un=' + data['un'] ); params.push( 'w=' + data['w'] ); params.push( 'h=' + data['h'] ); if( 'r' in data ) params.push( 'r=' + data['r'] ); params.push( 't=' + data['t'] ); // set up URL sendUrl = (params.length > 0 ? '?' : ''); sendUrl += params.join('&'); return sendUrl; }, //************************************************************************** // create element function (make tag and set each attributes) //************************************************************************** createElementFactory: function(doc, tag, attrs) { var ele = doc.createElement(tag); for(var key in attrs){ if(typeof attrs[key] === 'function'){ continue; } ele[key] = attrs[key]; } return ele; }, //************************************************************************** // create script element (without using document.write) //************************************************************************** createScriptElement: function(doc, parent, src){ var attrs = { "src":src, "type":"text/javascript" }; var ele = this.createElementFactory(doc, 'script', attrs); parent.appendChild(ele); }, //************************************************************************** // Write Hidden Tag //************************************************************************** writeHiddenData: function(doc, form, data) { var protocol = location.protocol; var customerId = data.id; var sendUrl = this.sendUrls(customerId); // //setup first party cookie for smart phone. // if( SibullaTag.Browser.isSmartPhone() ){ data = this.setupFirstPartyCookie( data ); } // // hash to array // var params = new Array(); for( var n in data ){ if( typeof(params[n]) == 'function' ){ continue; } if( n == 'REFERER' || n == 'w' || n == 't' ){ continue; } params.push( { name: n, value: data[n] } ); } // // append exclude flag // if (SibullaTag.Config.isExcluded()) { params.push( { name: 'ef', value: '1' } ); } // //append title, width and referer // if( 't' in data ){ params.push( { name: 't', value: data['t'] } ); } if( 'w' in data ){ params.push( { name: 'w', value: data['w'] } ); } if( 'REFERER' in data ){ params.push( { name: 'REFERER', value: data['REFERER'] } ); } // //write hidden tag // for( var i = 0; i < params.length; i++ ){ if( typeof(params[i]) == 'function' ){ continue; } this.createHiddenElement( doc, form, params[i].name, params[i].value ); } }, //************************************************************************** // create hidden tag //************************************************************************** createHiddenElement: function(doc, parent, name, value) { var attrs = { "type":"hidden", "name":name, "value":value }; var ele = this.createElementFactory(doc, 'input', attrs); parent.appendChild(ele); return ele; }, //************************************************************************** // get current url(current page url & referer url) //************************************************************************** getCurrentUrls: function() { var refer = ''; var url = ''; try{ if (document.referrer == parent.frames.location) { refer = top.document.referrer.toString(); url = location.href.toString(); } else { refer = document.referrer.toString(); url = document.location.href.toString(); } if (refer.length == "" && window.opener != null) { refer = window.opener.location.toString(); url = location.href.toString(); } }catch(e){ refer = document.referrer.toString(); url = location.href.toString(); } return { 'referer': refer, 'request': url }; }, //************************************************************************** // subtract parameter //************************************************************************** getSubtractParam: function(refer) { try{ if (refer == null || refer.length == 0 || (refer.indexOf("http://",0) == -1 && refer.indexOf("https://",0) == -1)) { return ""; } } catch(Exception){ return ""; } var new_refer = refer; var index = refer.indexOf("?",0); if (index != -1 || refer.length < index) { new_refer = refer.substring(0,index); } return new_refer; }, //************************************************************************** // initilize ec data //************************************************************************** initEcData: function(cno, totalBuyCount, totalBuyMoney, orderNo, totalPrice) { return { 'cust_no': cno || '', //customer no 'total_buy_count': (totalBuyCount ? parseInt(totalBuyCount) : 0 ), //total buy count( including this timing) 'total_buy_money': (totalBuyMoney ? parseInt(totalBuyMoney) : 0 ), //total buy money( including this timing) 'order_no': orderNo || '', //order no 'total_price': (totalPrice ? parseInt(totalPrice) : 0 ), //total price 'items': [] //array of detail item data }; }, //************************************************************************** // append ec item data //************************************************************************** appendEcItem: function(ecData, itemNo, itemName, itemCount, itemUnitPrice, itemPrice) { var item = { 'no': itemNo || '', //item no 'name': itemName || '', //item name 'count': ( itemCount == undefined ? 0 : parseInt(itemCount) ), //number 'unit_price': ( itemUnitPrice == undefined ? 0 : parseInt(itemUnitPrice) ), //unit price 'price': ( itemPrice == undefined ? 0 : parseInt(itemPrice) ) //total price( number * unit price) } ecData.items.push( item ); }, //************************************************************************** // create ec data //************************************************************************** createEcData: function(cno, totalBuyCount, totalBuyMoney, orderNo, totalPrice, itemNos, itemNames, itemCounts, itemUnitPrices, itemPrices, sep) { var nos = (itemNos ? itemNos.split(sep) : new Array()); var names = (itemNames ? itemNames.split(sep) : new Array()); var counts = (itemCounts ? itemCounts.split(sep) : new Array()); var unitPrices = (itemUnitPrices ? itemUnitPrices.split(sep) : new Array()); var prices = (itemPrices ? itemPrices.split(sep) : new Array()); var ecData = this.initEcData(cno, totalBuyCount, totalBuyMoney, orderNo, totalPrice); for( var i = 0; i < nos.length; i++ ){ var no = nos[i]; var name = names[i] || ''; var count = (counts[i] ? parseInt(counts[i]) : 0); var unitPrice = (unitPrices[i] ? parseInt(unitPrices[i]) : 0); var price = (prices[i] ? parseInt(prices[i]) : 0); this.appendEcItem( ecData, no, name, count, unitPrice, price ); } return ecData; }, /** * create html element * * @access public * @param {string} tag * @param {Object} attrs * @param {Document} doc * @param {mixed} parentElementOrId * @returns {Element} */ create: function(tag, attrs, doc, parentElementOrId) { var Utils = SibullaTag.Utils; attrs = attrs || {}; doc = doc || window.document; var ele = document.createElement( tag ); for( var name in attrs ){ if( typeof(attrs[name]) == 'function' ){ continue; } if( name == 'id' ){ ele.id = attrs[name]; } else{ ele.setAttribute( name, attrs[name] ); } } if( parentElementOrId ){ var parent = !Utils.isString(parentElementOrId) ? parentElementOrId : doc.getElementById(parentElementOrId); parent.appendChild( ele ); } return ele; }, /** * remove html element * * @access public * @param {mixed} elementOrId * @param {Document} doc * @returns {void} */ remove: function(elementOrId, doc) { var Utils = SibullaTag.Utils; doc = doc || window.document; var element = Utils.isObject(elementOrId) ? elementOrId : doc.getElementById(elementOrId); if( doc.getElementById(element.id) ){ doc.body.removeChild( element ); } }, /** * createScriptTag * * @access public * @param {Document} doc * @param {string} src * @param {mixed} parentElementOrId * @returns {Element} */ createScriptTag: function(doc, src, parentElementOrId) { var Element = SibullaTag.Element; var attrs = { "src": src, "type": "text/javascript" }; return Element.create( 'script', attrs, doc, parentElementOrId ); }, /** * createInputTag * * @access public * @param {Document} doc * @param {string} type * @param {string} name * @param {string} value * @param {mixed} parentOrForm * @returns {Element} */ createInputTag: function(doc, type, name, value, parentOrForm) { var Element = SibullaTag.Element; var attrs = { "type": type, "name": name, "value": value }; return Element.create( 'input', attrs, doc, parentOrForm ); } }; //////////////////////////////////////////////////////////////////////////////// // CustomParam //////////////////////////////////////////////////////////////////////////////// SibullaTag.CustomParam = { userName: '' ,mailAddr: '' ,orgName: '' ,orgCountryName: '' ,orgPrefName: '' ,orgCityName: '' ,setUserName: function(userName){ this.userName = userName; } ,setMailAddr: function(mailAddr){ this.mailAddr = mailAddr; } ,setOrgName: function(orgName){ this.orgName = orgName; } ,setOrgCountryName: function(orgCountryName){ this.orgCountryName = orgCountryName; } ,setOrgPrefName: function(orgPrefName){ this.orgPrefName = orgPrefName; } ,setOrgCityName: function(orgCityName){ this.orgCityName = orgCityName; } ,send: function(customerId){ var urls = SibullaTag.Element.getCurrentUrls(); var data = { 'un': SibullaTag.Utils.urlEncode( this.userName ), 'id': customerId, 't': SibullaTag.Utils.urlEncode( document.title ), 'w': screen.width, 'h': screen.height, 'URL': SibullaTag.Utils.urlEncode( urls.request ), 'REFERER': SibullaTag.Utils.urlEncode( urls.referer ) }; SibullaTag.Element.sendGetData( data ); //send event log SibullaTag.Tracker.sendClickEvent(customerId, 'form', '', this.getEventValue()); } ,getEventValue: function(){ return { 'name': this.userName, 'mailAddr': this.mailAddr, 'orgName': this.orgName, 'orgCountryName': this.orgCountryName, 'orgPrefName': this.orgPrefName, 'orgCityName': this.orgCityName }; } }; //////////////////////////////////////////////////////////////////////////////// // EventParam //////////////////////////////////////////////////////////////////////////////// SibullaTag.EventParam = { createSendGetUrl: function(data){ var Browser = SibullaTag.Browser, Element = SibullaTag.Element, params = new Array(), customerId = data.id, sendUrl = SibullaTag.Element.sendUrls(customerId); // set up params params.push( 'id=' + data['id'] ); if( SibullaTag.Browser.isSmartPhone() ) { data = Element.setupFirstPartyCookie( data ); params.push( 'si=' + data['si'] ); if (data['vi']) params.push( 'vi=' + data['vi'] ); params.push( 'gvi=' + data['sibu_vid'] ); } params.push( 're=1' ); params.push( 'js=1' ); if (SibullaTag.Config.isExcluded()) { params.push( 'ef=1' ); } params.push( 'et=' + data['et'] ); params.push( 'est=' + data['est'] ); params.push( 'ev=' + data['ev'] ); if( 'URL' in data ) params.push( 'URL=' + data['URL'] ); if( 'REFERER' in data ) params.push( 'REFERER=' + data['REFERER'] ); params.push( 'w=' + data['w'] ); params.push( 'h=' + data['h'] ); // set up URL sendUrl = (params.length > 0 ? '?' : ''); sendUrl += params.join('&'); return sendUrl; } }; //////////////////////////////////////////////////////////////////////////////// // Event //////////////////////////////////////////////////////////////////////////////// SibullaTag.Event ={ eventLogSendPath: 'event', deviceEventMap:{ pc:{'click':'mousedown'}, sm:{'click':'touchstart'} }, defaultExtNames: ['jpg','gif','png','bmp','tif','zip','pdf','doc','docx','rtf','xls','xlsx','xlsm','ppt','pptx','txt'], getDefaultExtNames: function(){ return SibullaTag.Event.defaultExtNames.slice(); }, eventAttachedClass: 'sibulla_event_attached', /** * getEventAttachedClass */ getEventAttachedClass: function(id){ id = id || ''; return this.eventAttachedClass + '_' + id; }, /** * getDeviceKind */ getDeviceKind: function(){ var Browser = SibullaTag.Browser; return (Browser.isSmartPhone())? 'sm':'pc'; }, /** * getEventKind * @param {string} eventName * @return {string} */ getEventKind: function(eventName){ var deviceKind = this.getDeviceKind(); if(!(eventName in this.deviceEventMap[deviceKind])){ return eventName; } return this.deviceEventMap[deviceKind][eventName]; }, /** * addEvent * * @access public * @param {Object} targetEl * @param {string} eventName * @param {function} handler * @param {Boolean} isUseCapture * @returns {function} */ addEvent: function(targetEl, eventName, handler, isUseCapture) { var Utils = SibullaTag.Utils, Event = SibullaTag.Event; isUseCapture = isUseCapture || false; var func = Utils.emptyFn; var eventKind = Event.getEventKind(eventName); if( targetEl.addEventListener ){ targetEl.addEventListener( eventKind, handler, isUseCapture ); return handler; } else if( targetEl.attachEvent ){ func = function(){ var e = window.event; e.preventDefault = e.preventDefault || function () { e.returnValue = false; }; e.stopPropagation = e.stopPropagation || function () { e.cancelBubble = true; }; handler.call( targetEl, e ); }; targetEl.attachEvent( 'on' + eventKind, func ); } return func; } }; //////////////////////////////////////////////////////////////////////////////// // Tracker //////////////////////////////////////////////////////////////////////////////// SibullaTag.Tracker = { regUrls: {}, /** * setRegUrls * @param {string} id */ setRegUrls: function(id) { var Config = SibullaTag.Config ,Utils = SibullaTag.Utils ,siteUrls = Config.getSiteUrls(id); ; var me = this ,urls = [] ; for( var i = 0; i < siteUrls.length; i++ ){ urls.push( Utils.quoteRegExpString(siteUrls[i].replace(/^(?:[a-z0-9]+\:)?(?:\/\/)?/i, '')) ); } me.regUrls[id] = urls; }, /** * getRegUrls * @param {string} id * @return {object} */ getRegUrls: function(id) { var me = this; if(!(id in me.regUrls)){ me.setRegUrls(id); } return me.regUrls[id]; }, /** * getInnerSiteUrlRegExp * * @access public * @returns {RegExp} */ getInnerSiteUrlRegExp: function(id) { var me = this; return new RegExp('^((https?:)?\/\/(' + me.getRegUrls(id).join('|') + '))?(?!(https?:)?\/\/).*'); }, /** * getOuterSiteUrlRegExp * * @access public * @returns {RegExp} */ getOuterSiteUrlRegExp: function(id) { var me = this; return new RegExp('^(https?:)?\/\/(?!' + me.getRegUrls(id).join('|') + ').*'); }, /** * setup outer file download click event * * @access public * @param {String} id * @param {String} className * @param {Array} extNames * @returns {Tracker} */ isAutoSendOuterDownloadLinkEvent: function(id, className, extNames) { var Event = SibullaTag.Event ,Utils = SibullaTag.Utils ,me = this ; extNames = extNames || []; if(!Utils.isArray(extNames)) extNames = [extNames]; if(extNames.length < 1) extNames = Event.getDefaultExtNames(); return me.isAutoSendClickEvent(id, '', 'download', 'outer', me.getOuterSiteUrlRegExp(id), className, extNames); }, /** * setup inner file download click event * * @access public * @param {String} id * @param {String} className * @param {Array} extNames * @returns {Tracker} */ isAutoSendInnerDownloadLinkEvent: function(id, className, extNames) { var Event = SibullaTag.Event ,Utils = SibullaTag.Utils ,me = this ; extNames = extNames || []; if(!Utils.isArray(extNames)) extNames = [extNames]; if(extNames.length < 1) extNames = Event.getDefaultExtNames(); return me.isAutoSendClickEvent(id, '', 'download', 'inner', me.getInnerSiteUrlRegExp(id), className, extNames); }, /** * setup outerlink click event * * @access public * @param {String} id * @param {String} className * @param {Array} extNames * @returns {Tracker} */ isAutoSendOuterSiteLinkEvent: function(id, className, extNames) { var me = this; return me.isAutoSendClickEvent(id, '', 'link', 'outer', me.getOuterSiteUrlRegExp(id), className, extNames); }, /** * setup innerlink click event * * @access public * @param {String} id * @param {String} className * @param {Array} extNames * @returns {Tracker} */ isAutoSendInnerSiteLinkEvent: function(id, className, extNames) { var me = this; return me.isAutoSendClickEvent(id, '', 'link', 'inner', me.getInnerSiteUrlRegExp(id), className, extNames); }, /** * setup click event * * @access public * @param {String} id * @param {String} subType * @param {String} kind * @param {String} direction * @param {RegExp} regexp * @param {String} className * @param {Array} extNames * @returns {Tracker} */ isAutoSendClickEvent: function(id, subType, kind, direction, regexp, className, extNames) { var me = this; return me.setEventLogSendLinker(id, 'click', subType, kind, direction, regexp, className, extNames); }, /** * set up click event * * @access private * @param {String} id * @param {String} type * @param {String} subType * @param {String} kind * @param {String} direction * @param {RegExp} regexp * @param {String} className * @param {Array} extNames * @returns {Tracker} */ setEventLogSendLinker: function(id, type, subType, kind, direction, regexp, className, extNames) { var me = this; var Utils = SibullaTag.Utils; var Event = SibullaTag.Event; var Ses = SibullaTag.SimpleElementSelector; className = className || ''; extNames = extNames || []; extNames = Utils.isArray(extNames) ? extNames : [extNames]; var cond = 'a' + (className.length == 0 || className[0] == '.' ? '' : '.') + className; for( var i = 0; i < extNames.length; i++ ){ extNames[i] = Utils.quoteRegExpString( ((extNames[i].length > 0 && extNames[i][0] != '.') ? '.' : '') + extNames[i] ); } var extRegExp = extNames.length == 0 ? null : new RegExp( '^[^\?\#]+(' + extNames.join('|') + ')[\?\#]?', 'i' ); var els = Ses.selector( cond, [regexp] ); for( var i = 0; i < els.length; i++ ){ var el = els[i]; var url = el.getAttribute('href'); if(!url) continue; var pos = url.indexOf('#'); url = (pos > -1 ? url.substr(0, pos) : url); var pos = url.indexOf('?'); url = (pos > -1 ? url.substr(0, pos) : url); if( extRegExp && !extRegExp.test(url) ){ continue; } if( Utils.isExistInArray(Ses.getElementClassName(el).split(' '), Event.getEventAttachedClass(id)) ){ continue; } else { Ses.addElementClassName(el, Event.getEventAttachedClass(id)); } //set up click event Event.addEvent( el, 'click', function(e){ var el = this; //send click event log me.sendClickEvent(id, type, subType, {'url': el.getAttribute('href'), 'kind': kind, 'direction': direction}); }); } return me; }, /** * send click link event log * * @access public * @param {String} id * @param {object} value * @returns {Tracker} */ sendClickLinkEvent: function(id, value){ if(!id || !value) return; var me = this ,innerPattern = me.getInnerSiteUrlRegExp(id) ,direction = '' ,kind = 'link' ; direction = (value.match(innerPattern))? 'inner': 'outer'; me.sendClickEvent(id, 'click', '', {'url': value, 'kind': kind, 'direction': direction}); return me; }, /** * send click event log * * @access public * @param {String} id * @param {String} type * @param {String} subType * @param {object} value * @returns {Tracker} */ sendClickEvent: function(id, type, subType, value){ var Utils = SibullaTag.Utils ,Element = SibullaTag.Element ,urls = Element.getCurrentUrls() ,me = this ; // // send log // me.sendTrackingData({ 'id': id, 'w': screen.width, 'h': screen.height, 'URL': Utils.urlEncode( urls.request ), 'REFERER': Utils.urlEncode( urls.referer ), 'et': type, 'est': subType, 'ev': Utils.urlEncode(Utils.jsonEncode(value)) }); return me; }, /** * send log data * * @access private * @param {Object} data * @returns {Tracker} */ sendTrackingData: function(data) { var me = this ,Element = SibullaTag.Element ,Event = SibullaTag.Event ,EventParam = SibullaTag.EventParam ,id = data.id ; var url = Element.sendUrls(id, Event.eventLogSendPath); url += EventParam.createSendGetUrl(data); Element.createScriptTag( document, url, document.getElementsByTagName("head")[0] ); return me; } } //////////////////////////////////////////////////////////////////////////////// // Main //////////////////////////////////////////////////////////////////////////////// SibullaTag.Main = { init: function(id,logServer,cookieData,setOnload,siteUrls){ // Log Server Setting SibullaTag.Config.setLogServer(id,logServer); // Site Url Setting SibullaTag.Config.setSiteUrls(id,siteUrls); // third party cookie setting SibullaTag.Config.setThirdCookieData(cookieData); if (setOnload) { // onload event setting SibullaTag.Config.setOnloadEvent(); } } }; //////////////////////////////////////////////////////////////////////////////// // Compatibility //////////////////////////////////////////////////////////////////////////////// if (!Object.keys) { Object.keys = (function() { 'use strict'; var hasOwnProperty = Object.prototype.hasOwnProperty, hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'), dontEnums = [ 'toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'constructor' ], dontEnumsLength = dontEnums.length; return function(obj) { if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) { throw new TypeError('Object.keys called on non-object'); } var result = [], prop, i; for (prop in obj) { if (hasOwnProperty.call(obj, prop)) { result.push(prop); } } if (hasDontEnumBug) { for (i = 0; i < dontEnumsLength; i++) { if (hasOwnProperty.call(obj, dontEnums[i])) { result.push(dontEnums[i]); } } } return result; }; }()); } }()); // initialize SibullaTag.Main.init('mbs8dT6R','wl004.sibulla.com','{"si":"07EDFDF817EAC8BCAA61523A0B1392A2","sn":"20","vi":"","sibu_vid":"po6Xcw7dtzaEr","exclude":"false"}',false,['http://aisantec.co.jp','https://aisantec.co.jp','http://www.aisantec.co.jp','https://www.aisantec.co.jp','http://atmsp.aisantec.com/atmspark/','https://atmsp.aisantec.com/atmspark/','http://www.atmsp.aisantec.com/atmspark/','https://www.atmsp.aisantec.com/atmspark/','http://g-spatial.com','https://g-spatial.com','http://www.g-spatial.com','https://www.g-spatial.com','http://tegakimoji.com','https://tegakimoji.com','http://www.tegakimoji.com','https://www.tegakimoji.com','http://whatmms.com','https://whatmms.com','http://www.whatmms.com','https://www.whatmms.com','http://wn-infinity.net','https://wn-infinity.net','http://www.wn-infinity.net','https://www.wn-infinity.net']); //***************************************************************************** //regular type //***************************************************************************** function c6f67(id) { var urls = SibullaTag.Element.getCurrentUrls(); var data = { 'id': id, 't': SibullaTag.Utils.urlEncode( document.title ), 'w': screen.width, 'h': screen.height, 'REFERER': SibullaTag.Utils.urlEncode( urls.referer ) }; SibullaTag.Element.sendGetData( data ); } //***************************************************************************** //referer without params type //***************************************************************************** function c6f68(id) { var urls = SibullaTag.Element.getCurrentUrls(); var data = { 'id': id, 't': SibullaTag.Utils.urlEncode( document.title ), 'w': screen.width, 'h': screen.height, 'REFERER': SibullaTag.Utils.urlEncode( SibullaTag.Element.getSubtractParam( urls.referer ) ) }; SibullaTag.Element.sendGetData( data ); } //***************************************************************************** //send current url without params //***************************************************************************** function c6f69(id) { var urls = SibullaTag.Element.getCurrentUrls(); var data = { 'id': id, 't': SibullaTag.Utils.urlEncode( document.title ), 'w': screen.width, 'h': screen.height, 'URL': SibullaTag.Utils.urlEncode( SibullaTag.Element.getSubtractParam( urls.request ) ), 'REFERER': SibullaTag.Utils.urlEncode( urls.referer ) }; SibullaTag.Element.sendGetData( data ); } //***************************************************************************** //send current url with user param //***************************************************************************** function c6f70(id, param) { var urls = SibullaTag.Element.getCurrentUrls(); var prms = (param != undefined ? '?' + param : ''); var data = { 'id': id, 't': SibullaTag.Utils.urlEncode( document.title ), 'w': screen.width, 'h': screen.height, 'URL': SibullaTag.Utils.urlEncode( SibullaTag.Element.getSubtractParam(urls.request) + prms ), 'REFERER': SibullaTag.Utils.urlEncode( urls.referer ) }; SibullaTag.Element.sendGetData( data ); } //***************************************************************************** //send flash click log //***************************************************************************** function c6f71(id, gifid, param) { var urls = SibullaTag.Element.getCurrentUrls(); var prms = (param != undefined ? '?' + param : ''); var dt = new Date(); var data = { 'r': dt.getTime(), 'id': id, 't': SibullaTag.Utils.urlEncode( document.title ), 'w': screen.width, 'h': screen.height, 'URL': SibullaTag.Utils.urlEncode( SibullaTag.Element.getSubtractParam(urls.request) + prms ), 'REFERER': SibullaTag.Utils.urlEncode( urls.referer ) }; var objImg = document.images[gifid]; SibullaTag.Element.sendGetData( data, objImg ); } //__Start_Of_Dynamic_Only__ //***************************************************************************** // ATTENSION!! Dynamic tag server only!! //frame site send log //***************************************************************************** function c6f72(id) { var urls = SibullaTag.Element.getCurrentUrls(); var refer = urls.referer; var siteurls = new Array('http://aisantec.co.jp','https://aisantec.co.jp','http://www.aisantec.co.jp','https://www.aisantec.co.jp','http://atmsp.aisantec.com/atmspark/','https://atmsp.aisantec.com/atmspark/','http://www.atmsp.aisantec.com/atmspark/','https://www.atmsp.aisantec.com/atmspark/','http://g-spatial.com','https://g-spatial.com','http://www.g-spatial.com','https://www.g-spatial.com','http://tegakimoji.com','https://tegakimoji.com','http://www.tegakimoji.com','https://www.tegakimoji.com','http://whatmms.com','https://whatmms.com','http://www.whatmms.com','https://www.whatmms.com','http://wn-infinity.net','https://wn-infinity.net','http://www.wn-infinity.net','https://www.wn-infinity.net'); // get referer from cookie for(var n in siteurls){ if( typeof(siteurls[n]) == 'function' ){ continue; } var siteurl = siteurls[n]; if( siteurl == refer.substring(0, siteurl.length) ){ refer = SibullaTag.Utils.getCookie( 'siburefer' ); break; } } // set request url to cookie SibullaTag.Utils.setCookie( 'siburefer', location.href ); var data = { 'id': id, 't': SibullaTag.Utils.urlEncode( document.title ), 'w': screen.width, 'h': screen.height, 'REFERER': SibullaTag.Utils.urlEncode( refer ) }; SibullaTag.Element.sendGetData( data ); } //__End_Of_Dynamic_Only__ //***************************************************************************** // send with ec data // and send event log //***************************************************************************** function c6f73(id, ecData) { var ec = SibullaTag.Utils.jsonEncode( ecData ); var urls = SibullaTag.Element.getCurrentUrls(); var data = { 'ec': SibullaTag.Utils.urlEncode( ec ), 'id': id, 't': SibullaTag.Utils.urlEncode( document.title ), 'w': screen.width, 'h': screen.height, 'URL': urls.request, 'REFERER': urls.referer }; //add onload event SibullaTag.Event.addEvent(window, 'load', function(){ SibullaTag.Element.sendPostData( data ); }); //send event log sibullaSendEcLog(id,ecData); } //***************************************************************************** //send flash click log (new version) //***************************************************************************** function c6f74(id, param) { var urls = SibullaTag.Element.getCurrentUrls(); var prms = (param != undefined ? '?' + param : ''); var dt = new Date(); var data = { 'r': dt.getTime(), 'id': id, 't': SibullaTag.Utils.urlEncode( document.title ), 'w': screen.width, 'h': screen.height, 'URL': SibullaTag.Utils.urlEncode( SibullaTag.Element.getSubtractParam(urls.request) + prms ), 'REFERER': SibullaTag.Utils.urlEncode( urls.referer ) }; // create or get sibulla image gif element var imgId = 'sibulla_gif' + id + new Date().getTime(); var objImg = null; try{ objImg = document.getElementById(imgId); } catch( e ){ ; } if( !objImg ){ objImg = document.createElement('img'); objImg.id = imgId; objImg.width = 1; objImg.height = 1; document.body.appendChild( objImg ); } SibullaTag.Element.sendGetData( data, objImg ); return true; } //***************************************************************************** // send with user name, mailaddress, organization name, organization country name, organization city name // and send event log //***************************************************************************** function c6f75(id, userName, mailAddr, orgName, orgCountryName, orgPrefName, orgCityName) { var sibulla = SibullaTag.CustomParam; if (userName != undefined) sibulla.setUserName(userName); if (mailAddr != undefined) sibulla.setMailAddr(mailAddr); if (orgName != undefined) sibulla.setOrgName(orgName); if (orgCountryName != undefined) sibulla.setOrgCountryName(orgCountryName); if (orgPrefName != undefined) sibulla.setOrgPrefName(orgPrefName); if (orgCityName != undefined) sibulla.setOrgCityName(orgCityName); sibulla.send(id); } //***************************************************************************** // send event log methods //***************************************************************************** // outer file download function sibullaSendOuterDownloadLink(id,cName,extNames){ SibullaTag.Tracker.isAutoSendOuterDownloadLinkEvent(id, cName, extNames); } // inner file download function sibullaSendInnerDownloadLink(id,cName,extNames){ SibullaTag.Tracker.isAutoSendInnerDownloadLinkEvent(id, cName, extNames); } // outer link function sibullaSendOuterSiteLink(id,cName,extNames){ SibullaTag.Tracker.isAutoSendOuterSiteLinkEvent(id, cName, extNames); } // inner link function sibullaSendInnerSiteLink(id,cName,extNames){ SibullaTag.Tracker.isAutoSendInnerSiteLinkEvent(id, cName, extNames); } // original link event function sibullaSendClickLinkLog(id,value){ SibullaTag.Tracker.sendClickLinkEvent(id,value); } // ec log function sibullaSendEcLog(id,value){ SibullaTag.Tracker.sendClickEvent(id, 'ec', '', value); } // form log function sibullaSendFormLog(id,name,mailAddr,orgName,orgCountryName,orgPrefName,orgCityName){ var obj = { 'name':'' ,'mailAddr':'' ,'orgName': '' ,'orgCountryName':'' ,'orgPrefName':'' ,'orgCityName':'' }; if(name) obj.name = name; if(mailAddr) obj.mailAddr = mailAddr; if(orgName) obj.orgName = orgName; if(orgCountryName) obj.orgCountryName = orgCountryName; if(orgPrefName) obj.orgPrefName = orgPrefName; if(orgCityName) obj.orgCityName = orgCityName; sibullaSendFormObjLog(id,obj); } // form log function sibullaSendFormObjLog(id,obj){ if(obj.name) SibullaTag.CustomParam.setUserName(obj.name); if(obj.mailAddr) SibullaTag.CustomParam.setMailAddr(obj.mailAddr); if(obj.orgName) SibullaTag.CustomParam.setOrgName(obj.orgName); if(obj.orgCountryName) SibullaTag.CustomParam.setOrgCountryName(obj.orgCountryName); if(obj.orgPrefName) SibullaTag.CustomParam.setOrgPrefName(obj.orgPrefName); if(obj.orgCityName) SibullaTag.CustomParam.setOrgCityName(obj.orgCityName); var value = SibullaTag.CustomParam.getEventValue(); SibullaTag.Tracker.sendClickEvent(id, 'form', '', value); } //////////////////////////////////////////////////////////////////////////////// // for Compatibility //////////////////////////////////////////////////////////////////////////////// if(!window.SIBULIB) SIBULIB = {}; SIBULIB.addEvent = function(target, eventName, handler){ return SibullaTag.Event.addEvent(target, eventName, handler); }; SIBULIB.initEcData = function(cno, totalBuyCount, totalBuyMoney, orderNo, totalPrice){ return SibullaTag.Element.initEcData(cno, totalBuyCount, totalBuyMoney, orderNo, totalPrice); }; SIBULIB.appendEcItem = function(ecData, itemNo, itemName, itemCount, itemUnitPrice, itemPrice){ return SibullaTag.Element.appendEcItem(ecData, itemNo, itemName, itemCount, itemUnitPrice, itemPrice); }; SIBULIB.createEcData = function(cno, totalBuyCount, totalBuyMoney, orderNo, totalPrice, itemNos, itemNames, itemCounts, itemUnitPrices, itemPrices, sep){ return SibullaTag.Element.createEcData(cno, totalBuyCount, totalBuyMoney, orderNo, totalPrice, itemNos, itemNames, itemCounts, itemUnitPrices, itemPrices, sep); }; (function() { var id = 'mbs8dT6R'; var param = ''; c6f67(id); })();