UNPKG

dop-website-sdk

Version:

Wisetracker website sdk ( dop-website-sdk )

878 lines (792 loc) 57.6 kB
// XSession.js import { ServiceIdentify } from "../dataObject/ServiceIdentify"; import { SProperties } from "../dataObject/SProperties"; import { TBehavior } from "../dot/TBehaviorData"; import queryString from 'query-string'; import { detect } from 'detect-browser'; export class Session { /** * constructor * 1. SDK do analyzing current document url, user-agent, cookies, referer. * 2. SDK check current session which expire or alive. ***/ constructor() { try { this.vtTz = new Date().getTime(); this.isVisitNew = "N"; // set sdk version this[window.RW_Constants.SESSION.SDK_VERSION] = SDK_VERSION; this.log("SDK Version : " + SDK_VERSION); this[window.RW_Constants.SESSION.COMBACK_USER_LIMIT_DAYS] = window.DOT_COMBACK_USER_LIMIT_DAYS; // set service id this[window.RW_Constants.SESSION.SERVICE_NO] = DOT_SNO; this.log("Service Id : " + DOT_SNO); // set service token this[window.RW_Constants.SESSION.SERVICE_TOKEN] = DOT_TOKEN; this.log("Service access token : " + DOT_TOKEN); // set data collector endpoint this[window.RW_Constants.SESSION.TRACKER_HOST] = DOT_ENDPOINT; this.log("Raw data collector endPoint : " + DOT_ENDPOINT); // uuid, sid 처리. this.lasestSessionCheck(); // analyzing from User-Agent this.analyzingUserAgent(); // analyzing from Cookies this.analyzingDocumentCookies(); // analyzing from request this.analyzingUrl(); // Internal Campaign this.analyzingCampaign(); // analyzing from Referrer ( DR , CR ) this.analyzingReferrer(window.RW_Constants.PAGE.REFERRER_STRING_FOR_WEB); // DR this.analyzingReferrer(window.RW_Constants.PAGE.CPC_REFERRER_STRING_FOR_WEB); // CR ( Paid only ) // if sdk created new session, do something if (this.isVisitNew == "Y") { // dau, wau, mau, qau, wau(us) this.checkUniqueActivVisitStatus(); // ltvt, ltvi, udvt, this.updateVisitCountData(); } } catch (e) { this.error(e); } } /*** * Expire Check Internal Campaign * ***/ analyzingCampaign() { try { let cIdentifyStr = window.RW_storage.getItem(window.RW_storage.CLIENT_IDENTIFY); if (cIdentifyStr != null) { let cIdentify = new SProperties(); cIdentify.putAll(JSON.parse(cIdentifyStr)); let _trackData = cIdentify["BEHAVIOR"][this[window.RW_Constants.SESSION.SERVICE_NO]]["T"]["data"]; if (_trackData != null) { if (_trackData[window.RW_Constants.INTERNAL_CAMPAIGN_INFO] != null) { let _savedCcData = { ..._trackData[window.RW_Constants.INTERNAL_CAMPAIGN_INFO] }; let _now = new Date().getTime(); for (let idx = 1; idx < 10; idx++) { if (_savedCcData["inrc" + idx] != null && _savedCcData["inrc" + idx] !== "") { let _expireTime = parseInt(_savedCcData["inrcTime" + idx]) + RW_timeutil.DAY * parseInt(_savedCcData["inrcDt" + idx]); if (_now > _expireTime) { delete _savedCcData["inrc" + idx]; delete _savedCcData["inrcTime" + idx]; delete _savedCcData["inrcDt" + idx]; } } } _trackData[window.RW_Constants.INTERNAL_CAMPAIGN_INFO] = _savedCcData; Object.keys(_savedCcData).forEach(function (key) { this[key] = _savedCcData[key]; }.bind(this)); window.RW_storage.setItem(window.RW_storage.CLIENT_IDENTIFY, JSON.stringify(cIdentify)); } } } } catch (e) { this.error(e); } } /** * Analyze Request Url * @private **/ analyzingUrl() { try { let needToAdInfoFromLocalStorage = true; this.log("SDK started to analyze request url. "); let url = document.createElement('a'); url.href = window.top.location.href; this[window.RW_Constants.PAGE.REQUEST_URL] = url.href; this.log("Request url : " + this[window.RW_Constants.PAGE.REQUEST_URL]); this[window.RW_Constants.PAGE.REQUEST_DOMAIN] = url.hostname || location.hostname; this.log("Request domain : " + this[window.RW_Constants.PAGE.REQUEST_DOMAIN]); if (url.href != "" && url.href.indexOf("?") > 0) { let _q = url.href.substring(url.href.indexOf("?") + 1); // const queryString = require('query-string'); const parsed = queryString.parse(_q); if (parsed != null) { this[window.RW_Constants.PAGE.REQUEST_QUERYSTRING] = _q; this.log("Request query string : " + this[window.RW_Constants.PAGE.REQUEST_QUERYSTRING]); this[window.RW_Constants.PAGE.REQUEST_QUERYSTRING_MAP] = parsed; this.log("Request query data : " + JSON.stringify(this[window.RW_Constants.PAGE.REQUEST_QUERYSTRING_MAP])); let tAdInfo = null; if (window.RW_Constants.REFERRER.DR_PARTNER in parsed && window.RW_Constants.REFERRER.DR_CAMPAIGN in parsed) { // wts this[window.RW_Constants.SESSION.DR_PARTNER] = this.nvl(parsed[window.RW_Constants.REFERRER.DR_PARTNER], ""); this.log("SDK detected ad channel : " + this[window.RW_Constants.SESSION.DR_PARTNER]); // wtc this[window.RW_Constants.SESSION.DR_CAMPAIGN] = this.nvl(parsed[window.RW_Constants.REFERRER.DR_CAMPAIGN], ""); this.log("SDK detected ad campaign : " + this[window.RW_Constants.SESSION.DR_CAMPAIGN]); // wtm this[window.RW_Constants.SESSION.DR_TYPE] = this.nvl(parsed[window.RW_Constants.REFERRER.DR_TYPE], ""); this.log("SDK detected ad type : " + this[window.RW_Constants.SESSION.DR_TYPE]); // wtw this[window.RW_Constants.SESSION.DR_KEYWORD] = this.nvl(parsed[window.RW_Constants.REFERRER.DR_KEYWORD], ""); this.log("SDK detected ad keyword : " + this[window.RW_Constants.SESSION.DR_KEYWORD]); // wtclkTime this[window.RW_Constants.SESSION.DR_CLICK_TIME] = parsed[window.RW_Constants.REFERRER.DR_CLICK_TIME]; if (typeof this[window.RW_Constants.SESSION.DR_CLICK_TIME] == "undefined") { this[window.RW_Constants.SESSION.DR_CLICK_TIME] = new Date().getTime(); } this.log("SDK detected ad click time : " + this[window.RW_Constants.SESSION.DR_CLICK_TIME]); // matNo this[window.RW_Constants.SESSION.DR_MATNO] = this.nvl(parsed[window.RW_Constants.REFERRER.TRACK_ID], ""); this.log("SDK detected ad matNo : " + this[window.RW_Constants.SESSION.DR_MATNO]); // wtp this[window.RW_Constants.SESSION.DR_EXPIRE_DAYS] = this.nvl(parsed[window.RW_Constants.REFERRER.INSTALL_EXPIRE_DAYS], 7); this.log("SDK detected ad window days : " + this[window.RW_Constants.SESSION.DR_EXPIRE_DAYS]); // wtckp this[window.RW_Constants.SESSION.DR_CLICK_EXPIRE_MINUTE] = this.nvl(parsed[window.RW_Constants.REFERRER.DR_CLICK_EXPIRE_MINUTE], 10080); this.log("SDK detected ad click window minutes : " + this[window.RW_Constants.SESSION.DR_CLICK_EXPIRE_MINUTE]); // wtaffid this[window.RW_Constants.SESSION.DR_AFFILIATE1] = this.nvl(parsed[window.RW_Constants.REFERRER.DR_AFFILIATE1], ""); this.log("SDK detected ad affiliate id ( depth 1 ) : " + this[window.RW_Constants.SESSION.DR_AFFILIATE1]); // wtaffid this[window.RW_Constants.SESSION.DR_AFFILIATE2] = this.nvl(parsed[window.RW_Constants.REFERRER.DR_AFFILIATE2], ""); this.log("SDK detected ad affiliate id ( depth 2 ) : " + this[window.RW_Constants.SESSION.DR_AFFILIATE2]); for (let exid = 1; exid <= 10; exid++) { this[window.RW_Constants.SESSION.DR_SUB + exid] = this.nvl(parsed[window.RW_Constants.REFERRER.DR_SUB + exid], ""); this.log("SDK detected ad extra parameter( " + exid + " ) : " + this[window.RW_Constants.SESSION.DR_SUB + exid]); } // wtcid this[window.RW_Constants.SESSION.DR_CLICK_ID] = this.nvl(parsed[window.RW_Constants.REFERRER.DR_CLICK_ID], ""); this.log("SDK detected ad click id : " + this[window.RW_Constants.SESSION.DR_CLICK_ID]); // wtpid this[window.RW_Constants.SESSION.DR_PARTNER_ID] = this.nvl(parsed[window.RW_Constants.REFERRER.DR_PARTNER_ID], ""); this.log("SDK detected ad Partner Id : " + this[window.RW_Constants.SESSION.DR_PARTNER_ID]); // postback numer this[window.RW_Constants.SESSION.DR_POSTBACK_NUMBER] = this.nvl(parsed[window.RW_Constants.REFERRER.DR_POSTBACK_TARGET], 0); this.log("SDK detected ad postback number : " + this[window.RW_Constants.SESSION.DR_POSTBACK_NUMBER]); // isRetarget this[window.RW_Constants.SESSION.DR_IS_RETARGETING] = this.nvl(parsed[window.RW_Constants.REFERRER.IS_RETARGETING], "N"); this.log("SDK detected ad is retargeting : " + this[window.RW_Constants.SESSION.DR_IS_RETARGETING]); // wcost this[window.RW_Constants.SESSION.DR_ROI_COST] = this.nvl(parsed[window.RW_Constants.REFERRER.ROI_COST], 0); this.log("SDK detected ad roi cost : " + this[window.RW_Constants.SESSION.DR_ROI_COST]); // wevtnm this[window.RW_Constants.SESSION.DR_ROI_EVENT_NAME] = this.nvl(parsed[window.RW_Constants.REFERRER.ROI_EVENT_NAME], ""); this.log("SDK detected ad event name : " + this[window.RW_Constants.SESSION.DR_ROI_EVENT_NAME]); // wcurcy this[window.RW_Constants.SESSION.DR_ROI_CURCY] = this.nvl(parsed[window.RW_Constants.REFERRER.ROI_CURCY], "KRW"); this.log("SDK detected ad currency : " + this[window.RW_Constants.SESSION.DR_ROI_CURCY]); // _partnerId this[window.RW_Constants.SESSION.DR__PARTNER] = this.nvl(parsed[window.RW_Constants.REFERRER._PARTNER], ""); this.log("SDK detected ad _partner : " + this[window.RW_Constants.SESSION.DR__PARTNER]); // _adset this[window.RW_Constants.SESSION.DR__AD_SET] = this.nvl(parsed[window.RW_Constants.REFERRER._AD_SET], ""); this.log("SDK detected ad _adset : " + this[window.RW_Constants.SESSION.DR__AD_SET]); // _adsetId this[window.RW_Constants.SESSION.DR__AD_SET_ID] = this.nvl(parsed[window.RW_Constants.REFERRER._AD_SET_ID], ""); this.log("SDK detected ad _adsetId : " + this[window.RW_Constants.SESSION.DR__AD_SET_ID]); // _ad this[window.RW_Constants.SESSION.DR__AD] = this.nvl(parsed[window.RW_Constants.REFERRER._AD], ""); this.log("SDK detected ad _ad : " + this[window.RW_Constants.SESSION.DR__AD]); // _adId this[window.RW_Constants.SESSION.DR__AD_ID] = this.nvl(parsed[window.RW_Constants.REFERRER._AD_ID], ""); this.log("SDK detected ad _adId : " + this[window.RW_Constants.SESSION.DR__AD_ID]); // _adtype this[window.RW_Constants.SESSION.DR__AD_TYPE] = this.nvl(parsed[window.RW_Constants.REFERRER._AD_TYPE], ""); this.log("SDK detected ad _adtype : " + this[window.RW_Constants.SESSION.DR__AD_TYPE]); // _wgcmpid this[window.RW_Constants.SESSION.LATEST_GOOGLE_CAMPAIGNID] = this.nvl(parsed[window.RW_Constants.REFERRER.GOOGLE_CAMPAIGN_ID], ""); this.log("SDK detected ad _wgcmpid : " + this[window.RW_Constants.SESSION.LATEST_GOOGLE_CAMPAIGNID]); // gclid this[window.RW_Constants.SESSION.LATEST_GOOGLE_CLICKID] = this.nvl(parsed[window.RW_Constants.REFERRER.GOOGLE_CLICK_ID], ""); this.log("SDK detected ad gclid : " + this[window.RW_Constants.SESSION.LATEST_GOOGLE_CLICKID]); // kakaoMk this[window.RW_Constants.SESSION.DR_KAKAO_MAT] = this.nvl(parsed[window.RW_Constants.REFERRER.KAKAO_MATKEY], ""); this.log("SDK detected ad kakao mat key : " + this[window.RW_Constants.SESSION.DR_KAKAO_MAT]); // --------------------------------------------------------------------------------------------------- // adInfo Save ( DR ) let tAdInfoObj = RW_TAdInfo.setWtref(url.href).setWts(this[window.RW_Constants.SESSION.DR_PARTNER]).setWtc(this[window.RW_Constants.SESSION.DR_CAMPAIGN]).setWtm(this[window.RW_Constants.SESSION.DR_TYPE]).setWtw(this[window.RW_Constants.SESSION.DR_KEYWORD]).setWClkTime(this[window.RW_Constants.SESSION.DR_CLICK_TIME]).setMatNo(this[window.RW_Constants.SESSION.DR_MATNO]).setWtp(this[window.RW_Constants.SESSION.DR_EXPIRE_DAYS]).setWckp(this[window.RW_Constants.SESSION.DR_CLICK_EXPIRE_MINUTE]).setWtaffid(this[window.RW_Constants.SESSION.DR_AFFILIATE1]).setWtbffid(this[window.RW_Constants.SESSION.DR_AFFILIATE2]).setWcid(this[window.RW_Constants.SESSION.DR_CLICK_ID]).setWtpid(this[window.RW_Constants.SESSION.DR_PARTNER_ID]).setPostbackNo(this[window.RW_Constants.SESSION.DR_POSTBACK_NUMBER]).setIsRetarget(this[window.RW_Constants.SESSION.DR_IS_RETARGETING]).setRoiCost(this[window.RW_Constants.SESSION.DR_ROI_COST]).setRoiEventName(this[window.RW_Constants.SESSION.DR_ROI_EVENT_NAME]).setRoiCurrency(this[window.RW_Constants.SESSION.DR_ROI_CURCY]).set_Partier(this[window.RW_Constants.SESSION.DR__PARTNER]).set_Adset(this[window.RW_Constants.SESSION.DR__AD_SET]).set_AdSetId(this[window.RW_Constants.SESSION.DR__AD_SET_ID]).set_Ad(this[window.RW_Constants.SESSION.DR__AD]).set_AdId(this[window.RW_Constants.SESSION.DR__AD_ID]).set_AdType(this[window.RW_Constants.SESSION.DR__AD_TYPE]).setGoogleCampaign(this[window.RW_Constants.SESSION.LATEST_GOOGLE_CAMPAIGNID]).setGoogleClickId(this[window.RW_Constants.SESSION.LATEST_GOOGLE_CLICKID]).setKakaoMk(this[window.RW_Constants.SESSION.DR_KAKAO_MAT]); for (let exid = 1; exid <= 10; exid++) { tAdInfoObj.setExtraData(exid, this[window.RW_Constants.SESSION.DR_SUB + exid]); } tAdInfo = tAdInfoObj.build(); this.log("SDK detected ad Info String : " + JSON.stringify(tAdInfo)); let cIdentifyStr = window.RW_storage.getItem(window.RW_storage.CLIENT_IDENTIFY); if (cIdentifyStr != null) { let cIdentify = new SProperties(); cIdentify.putAll(JSON.parse(cIdentifyStr)); let _trackData = cIdentify["BEHAVIOR"][this[window.RW_Constants.SESSION.SERVICE_NO]]["T"]["data"]; if (_trackData != null) { _trackData[window.RW_Constants.AD_ATTRIBUTION_INFO] = tAdInfo; window.RW_storage.setItem(window.RW_storage.CLIENT_IDENTIFY, JSON.stringify(cIdentify)); } } this[window.RW_Constants.SESSION.IS_DR_UPDATE] = "Y"; needToAdInfoFromLocalStorage = false; // --------------------------------------------------------------------------------------------------- } else { // cpc detecting ... if (window.RW_Constants.detectInfoList != null && window.RW_Constants.detectInfoList.length > 0) { for (let i = 0; i < window.RW_Constants.detectInfoList.length; i++) { let chkobj = window.RW_Constants.detectInfoList[i]; /** * 1. Referrer check **/ let _regExpRef = null; if (chkobj.referrer != "") { _regExpRef = new RegExp(chkobj.referrer, "i"); } let uagent = navigator.userAgent.toLocaleLowerCase(); let osVer = uagent.substring(uagent.indexOf("iphone os ") + 10, uagent.indexOf("iphone os ") + 15); if (_regExpRef == null || _regExpRef.test(document.referrer) || /iPhone|iPad|iPod/i.test(navigator.userAgent) && /^(1[3-9])/i.test(osVer) && document.referrer == "") { /** * 2. document url check **/ let _regExpDu = null; if (chkobj.documentUrl != "") { _regExpDu = new RegExp(chkobj.documentUrl, "i"); } if (_regExpDu == null || _regExpDu.test(document.location.href)) { if (chkobj.media == "NAVER" && /n_media=(118495|118496)/i.test(document.location.href)) { continue; } /** * 3. cpc keyword parameter check **/ if (chkobj.campaignParam != "") { var _cpcKwd = this.getParameter(chkobj.campaignParam, ""); if (_cpcKwd == '' && document.referrer != '') { _cpcKwd = this.getParameter(chkobj.campaignParam, "", document.referrer); } if (_cpcKwd != "") { // ########################################### // wts this[window.RW_Constants.SESSION.DR_PARTNER] = chkobj.program; this.log("SDK detected ad channel : " + this[window.RW_Constants.SESSION.DR_PARTNER]); // wtc this[window.RW_Constants.SESSION.DR_CAMPAIGN] = chkobj.programDiv; this.log("SDK detected ad campaign : " + this[window.RW_Constants.SESSION.DR_CAMPAIGN]); // wtm this[window.RW_Constants.SESSION.DR_TYPE] = ""; this.log("SDK detected ad type : " + this[window.RW_Constants.SESSION.DR_TYPE]); // wtw this[window.RW_Constants.SESSION.DR_KEYWORD] = _cpcKwd; this.log("SDK detected ad keyword : " + this[window.RW_Constants.SESSION.DR_KEYWORD]); // wtclkTime this[window.RW_Constants.SESSION.DR_CLICK_TIME] = new Date().getTime(); this.log("SDK detected ad click time : " + this[window.RW_Constants.SESSION.DR_CLICK_TIME]); // matNo this[window.RW_Constants.SESSION.DR_MATNO] = this.nvl(parsed[window.RW_Constants.REFERRER.TRACK_ID], ""); this.log("SDK detected ad matNo : " + this[window.RW_Constants.SESSION.DR_MATNO]); // wtp this[window.RW_Constants.SESSION.DR_EXPIRE_DAYS] = this.nvl(parsed[window.RW_Constants.REFERRER.INSTALL_EXPIRE_DAYS], 7); this.log("SDK detected ad window days : " + this[window.RW_Constants.SESSION.DR_EXPIRE_DAYS]); // wtckp this[window.RW_Constants.SESSION.DR_CLICK_EXPIRE_MINUTE] = this.nvl(parsed[window.RW_Constants.REFERRER.DR_CLICK_EXPIRE_MINUTE], 10080); this.log("SDK detected ad click window minutes : " + this[window.RW_Constants.SESSION.DR_CLICK_EXPIRE_MINUTE]); // wtaffid this[window.RW_Constants.SESSION.DR_AFFILIATE1] = this.nvl(parsed[window.RW_Constants.REFERRER.DR_AFFILIATE1], ""); this.log("SDK detected ad affiliate id ( depth 1 ) : " + this[window.RW_Constants.SESSION.DR_AFFILIATE1]); // wtaffid this[window.RW_Constants.SESSION.DR_AFFILIATE2] = this.nvl(parsed[window.RW_Constants.REFERRER.DR_AFFILIATE2], ""); this.log("SDK detected ad affiliate id ( depth 2 ) : " + this[window.RW_Constants.SESSION.DR_AFFILIATE2]); for (let exid = 1; exid <= 10; exid++) { this[window.RW_Constants.SESSION.DR_SUB + exid] = this.nvl(parsed[window.RW_Constants.REFERRER.DR_SUB + exid], ""); this.log("SDK detected ad extra parameter( " + exid + " ) : " + this[window.RW_Constants.SESSION.DR_SUB + exid]); } // wtcid this[window.RW_Constants.SESSION.DR_CLICK_ID] = this.nvl(parsed[window.RW_Constants.REFERRER.DR_CLICK_ID], ""); this.log("SDK detected ad click id : " + this[window.RW_Constants.SESSION.DR_CLICK_ID]); // wtpid this[window.RW_Constants.SESSION.DR_PARTNER_ID] = this.nvl(parsed[window.RW_Constants.REFERRER.DR_PARTNER_ID], ""); this.log("SDK detected ad Partner Id : " + this[window.RW_Constants.SESSION.DR_PARTNER_ID]); // postback numer this[window.RW_Constants.SESSION.DR_POSTBACK_NUMBER] = this.nvl(parsed[window.RW_Constants.REFERRER.DR_POSTBACK_TARGET], 0); this.log("SDK detected ad postback number : " + this[window.RW_Constants.SESSION.DR_POSTBACK_NUMBER]); // isRetarget this[window.RW_Constants.SESSION.DR_IS_RETARGETING] = this.nvl(parsed[window.RW_Constants.REFERRER.IS_RETARGETING], "N"); this.log("SDK detected ad is retargeting : " + this[window.RW_Constants.SESSION.DR_IS_RETARGETING]); // wcost this[window.RW_Constants.SESSION.DR_ROI_COST] = this.nvl(parsed[window.RW_Constants.REFERRER.ROI_COST], 0); this.log("SDK detected ad roi cost : " + this[window.RW_Constants.SESSION.DR_ROI_COST]); // wevtnm this[window.RW_Constants.SESSION.DR_ROI_EVENT_NAME] = this.nvl(parsed[window.RW_Constants.REFERRER.ROI_EVENT_NAME], ""); this.log("SDK detected ad event name : " + this[window.RW_Constants.SESSION.DR_ROI_EVENT_NAME]); // wcurcy this[window.RW_Constants.SESSION.DR_ROI_CURCY] = this.nvl(parsed[window.RW_Constants.REFERRER.ROI_CURCY], "KRW"); this.log("SDK detected ad currency : " + this[window.RW_Constants.SESSION.DR_ROI_CURCY]); // _partnerId this[window.RW_Constants.SESSION.DR__PARTNER] = this.nvl(parsed[window.RW_Constants.REFERRER._PARTNER], ""); this.log("SDK detected ad _partner : " + this[window.RW_Constants.SESSION.DR__PARTNER]); // _adset this[window.RW_Constants.SESSION.DR__AD_SET] = this.nvl(parsed[window.RW_Constants.REFERRER._AD_SET], ""); this.log("SDK detected ad _adset : " + this[window.RW_Constants.SESSION.DR__AD_SET]); // _adsetId this[window.RW_Constants.SESSION.DR__AD_SET_ID] = this.nvl(parsed[window.RW_Constants.REFERRER._AD_SET_ID], ""); this.log("SDK detected ad _adsetId : " + this[window.RW_Constants.SESSION.DR__AD_SET_ID]); // _ad this[window.RW_Constants.SESSION.DR__AD] = this.nvl(parsed[window.RW_Constants.REFERRER._AD], ""); this.log("SDK detected ad _ad : " + this[window.RW_Constants.SESSION.DR__AD]); // _adId this[window.RW_Constants.SESSION.DR__AD_ID] = this.nvl(parsed[window.RW_Constants.REFERRER._AD_ID], ""); this.log("SDK detected ad _adId : " + this[window.RW_Constants.SESSION.DR__AD_ID]); // _adtype this[window.RW_Constants.SESSION.DR__AD_TYPE] = this.nvl(parsed[window.RW_Constants.REFERRER._AD_TYPE], ""); this.log("SDK detected ad _adtype : " + this[window.RW_Constants.SESSION.DR__AD_TYPE]); // --------------------------------------------------------------------------------------------------- // adInfo Save ( DR ) let tAdInfoObj = RW_TAdInfo.setWtref(url.href).setWts(this[window.RW_Constants.SESSION.DR_PARTNER]).setWtc(this[window.RW_Constants.SESSION.DR_CAMPAIGN]).setWtm(this[window.RW_Constants.SESSION.DR_TYPE]).setWtw(this[window.RW_Constants.SESSION.DR_KEYWORD]).setWClkTime(this[window.RW_Constants.SESSION.DR_CLICK_TIME]).setMatNo(this[window.RW_Constants.SESSION.DR_MATNO]).setWtp(this[window.RW_Constants.SESSION.DR_EXPIRE_DAYS]).setWckp(this[window.RW_Constants.SESSION.DR_CLICK_EXPIRE_MINUTE]).setWtaffid(this[window.RW_Constants.SESSION.DR_AFFILIATE1]).setWtbffid(this[window.RW_Constants.SESSION.DR_AFFILIATE2]).setWcid(this[window.RW_Constants.SESSION.DR_CLICK_ID]).setWtpid(this[window.RW_Constants.SESSION.DR_PARTNER_ID]).setPostbackNo(this[window.RW_Constants.SESSION.DR_POSTBACK_NUMBER]).setIsRetarget(this[window.RW_Constants.SESSION.DR_IS_RETARGETING]).setRoiCost(this[window.RW_Constants.SESSION.DR_ROI_COST]).setRoiEventName(this[window.RW_Constants.SESSION.DR_ROI_EVENT_NAME]).setRoiCurrency(this[window.RW_Constants.SESSION.DR_ROI_CURCY]).set_Partier(this[window.RW_Constants.SESSION.DR__PARTNER]).set_Adset(this[window.RW_Constants.SESSION.DR__AD_SET]).set_AdSetId(this[window.RW_Constants.SESSION.DR__AD_SET_ID]).set_Ad(this[window.RW_Constants.SESSION.DR__AD]).set_AdId(this[window.RW_Constants.SESSION.DR__AD_ID]).set_AdType(this[window.RW_Constants.SESSION.DR__AD_TYPE]); for (let exid = 1; exid <= 10; exid++) { tAdInfoObj.setExtraData(exid, this[window.RW_Constants.SESSION.DR_SUB + exid]); } tAdInfo = tAdInfoObj.build(); this.log("SDK detected ad Info String : " + JSON.stringify(tAdInfo)); let cIdentifyStr = window.RW_storage.getItem(window.RW_storage.CLIENT_IDENTIFY); if (cIdentifyStr != null) { let cIdentify = new SProperties(); cIdentify.putAll(JSON.parse(cIdentifyStr)); let _trackData = cIdentify["BEHAVIOR"][this[window.RW_Constants.SESSION.SERVICE_NO]]["T"]["data"]; if (_trackData != null) { _trackData[window.RW_Constants.AD_ATTRIBUTION_INFO] = tAdInfo; window.RW_storage.setItem(window.RW_storage.CLIENT_IDENTIFY, JSON.stringify(cIdentify)); } } this[window.RW_Constants.SESSION.IS_DR_UPDATE] = "Y"; needToAdInfoFromLocalStorage = false; // ######################################### } } } } } } } /* ----------------------------------------------- // 클릭 데이터 발생 처리 필요 여부 체크 */ if (needToAdInfoFromLocalStorage === false) { try { if (document.referrer != null && document.referrer.indexOf("app.wisetracker.co.kr") < 0) { /* 파라미터가 추출된 주소값이 이전과 동일한 값인 경우 클릭 데이터를 발생 시키지 않아야 함. 페이지 리로딩에 의한 클릭수 증가 방지. */ if (window.DOT_AD_CLICKDATA_AUTO_CHECK == "Y") { // console.log("click data send "); if (tAdInfo != null) { let _referrerCheck = tAdInfo[window.RW_Constants.SESSION.DR_REFERRER_STRING]; if (_referrerCheck.indexOf("&wdotRef=WT") < 0) { let _clickData = { _wtno: window.DOT_SNO }; // ################################ // 기본 분석 파라미터 _clickData[window.RW_Constants.REFERRER.DR_PARTNER] = tAdInfo[window.RW_Constants.SESSION.DR_PARTNER]; _clickData[window.RW_Constants.REFERRER.DR_CAMPAIGN] = tAdInfo[window.RW_Constants.SESSION.DR_CAMPAIGN]; _clickData[window.RW_Constants.REFERRER.DR_TYPE] = tAdInfo[window.RW_Constants.SESSION.DR_TYPE]; _clickData[window.RW_Constants.REFERRER.DR_KEYWORD] = tAdInfo[window.RW_Constants.SESSION.DR_KEYWORD]; _clickData[window.RW_Constants.REFERRER.DR_CLICK_TIME] = tAdInfo[window.RW_Constants.SESSION.DR_CLICK_TIME]; _clickData[window.RW_Constants.REFERRER.TRACK_ID] = tAdInfo[window.RW_Constants.SESSION.DR_MATNO]; _clickData[window.RW_Constants.REFERRER.INSTALL_EXPIRE_DAYS] = tAdInfo[window.RW_Constants.SESSION.DR_EXPIRE_DAYS]; _clickData[window.RW_Constants.REFERRER.DR_CLICK_EXPIRE_MINUTE] = tAdInfo[window.RW_Constants.SESSION.DR_CLICK_EXPIRE_MINUTE]; // ################################ // 하위 퍼블리셔 분석 파라미터 _clickData[window.RW_Constants.REFERRER.DR_AFFILIATE1] = tAdInfo[window.RW_Constants.SESSION.DR_AFFILIATE1]; _clickData[window.RW_Constants.REFERRER.DR_AFFILIATE2] = tAdInfo[window.RW_Constants.SESSION.DR_AFFILIATE2]; // ################################ // 미디어 Customize 파라미터 _etd1 ~ 10 for (let exid = 1; exid <= 10; exid++) { _clickData[window.RW_Constants.REFERRER.DR_SUB + exid] = tAdInfo[window.RW_Constants.SESSION.DR_SUB + exid]; } // ################################ // Impression Id 파라미터 ( Click Id ) _clickData[window.RW_Constants.REFERRER.DR_CLICK_ID] = tAdInfo[window.RW_Constants.SESSION.DR_CLICK_ID]; // ################################ // 포스트백 파라미터 _clickData[window.RW_Constants.REFERRER.DR_PARTNER_ID] = tAdInfo[window.RW_Constants.SESSION.DR_PARTNER_ID]; _clickData[window.RW_Constants.REFERRER.DR_POSTBACK_TARGET] = tAdInfo[window.RW_Constants.SESSION.DR_POSTBACK_NUMBER]; // ################################ // Advanced parameter _clickData[window.RW_Constants.REFERRER.IS_RETARGETING] = tAdInfo[window.RW_Constants.SESSION.DR_IS_RETARGETING]; _clickData[window.RW_Constants.REFERRER.ROI_COST] = tAdInfo[window.RW_Constants.SESSION.DR_ROI_COST]; _clickData[window.RW_Constants.REFERRER.ROI_EVENT_NAME] = tAdInfo[window.RW_Constants.SESSION.DR_ROI_EVENT_NAME]; _clickData[window.RW_Constants.REFERRER.ROI_CURCY] = tAdInfo[window.RW_Constants.SESSION.DR_ROI_CURCY]; _clickData[window.RW_Constants.REFERRER._PARTNER] = tAdInfo[window.RW_Constants.SESSION.DR__PARTNER]; _clickData[window.RW_Constants.REFERRER._AD_SET] = tAdInfo[window.RW_Constants.SESSION.DR__AD_SET]; _clickData[window.RW_Constants.REFERRER._AD_SET_ID] = tAdInfo[window.RW_Constants.SESSION.DR__AD_SET_ID]; _clickData[window.RW_Constants.REFERRER._AD] = tAdInfo[window.RW_Constants.SESSION.DR__AD]; _clickData[window.RW_Constants.REFERRER._AD_ID] = tAdInfo[window.RW_Constants.SESSION.DR__AD_ID]; _clickData[window.RW_Constants.REFERRER._AD_TYPE] = tAdInfo[window.RW_Constants.SESSION.DR__AD_TYPE]; // ################################ // Google campaign _clickData[window.RW_Constants.REFERRER.GOOGLE_CAMPAIGN_ID] = tAdInfo[window.RW_Constants.SESSION.LATEST_GOOGLE_CAMPAIGNID]; _clickData[window.RW_Constants.REFERRER.GOOGLE_CLICK_ID] = tAdInfo[window.RW_Constants.SESSION.LATEST_GOOGLE_CLICKID]; // ################################# // KAKAO _clickData[window.RW_Constants.REFERRER.KAKAO_MATKEY] = tAdInfo[window.RW_Constants.SESSION.DR_KAKAO_MAT]; // 광고 클릭 파라미터 타입으로 맵 전환. _clickData["skipRefSave"] = "true"; // MongoDB Referrer save logic skip flag. window.RW_transmitter.sendAdClickDataToCollectorServer(window.RW_Constants.COMMAND, { data: encodeURIComponent(JSON.stringify(_clickData)) }, { authType: "uG20drA5G3Bzo87rzAfyUw==" }); } } } } } catch (e) { this.error(e); } } /* ---------------------------------------------- */ } } if (needToAdInfoFromLocalStorage) { let cIdentifyStr = window.RW_storage.getItem(window.RW_storage.CLIENT_IDENTIFY); if (cIdentifyStr != null) { let cIdentify = new SProperties(); cIdentify.putAll(JSON.parse(cIdentifyStr)); let _trackData = cIdentify["BEHAVIOR"][this[window.RW_Constants.SESSION.SERVICE_NO]]["T"]["data"]; if (_trackData != null) { let _attribution = _trackData[window.RW_Constants.AD_ATTRIBUTION_INFO]; if (_attribution != null) { let wtClkTime = _attribution[window.RW_Constants.SESSION.DR_CLICK_TIME]; let wtp = _attribution[window.RW_Constants.SESSION.DR_EXPIRE_DAYS]; let _nowTime = new Date().getTime(); if (_nowTime > wtClkTime + wtp * window.RW_timeutil.DAY) { delete _trackData[window.RW_Constants.AD_ATTRIBUTION_INFO]; window.RW_storage.setItem(window.RW_storage.CLIENT_IDENTIFY, JSON.stringify(cIdentify)); } else { for (var attr in _attribution) { if (_attribution.hasOwnProperty(attr)) { this[attr] = _attribution[attr]; } } } } } } } } catch (e) { this.error(e); } } /** * Analyze User-Agent * @private **/ analyzingUserAgent() { try { this.log("SDK started to analyze user agent string. "); // const { detect } = require('detect-browser'); const browser = detect(); this[window.RW_Constants.SESSION.BROWSER] = browser.name; this.log("Browser name : " + this[window.RW_Constants.SESSION.BROWSER]); this[window.RW_Constants.SESSION.BROWSER_VERSION] = browser.version; this.log("Browser version : " + this[window.RW_Constants.SESSION.BROWSER_VERSION]); this[window.RW_Constants.SESSION.OS] = browser.os; this.log("OS : " + this[window.RW_Constants.SESSION.OS]); let ua = navigator.userAgent; this[window.RW_Constants.SESSION.USER_AGENT] = ua; this.log("Original user-agent : " + this[window.RW_Constants.SESSION.USER_AGENT]); let language = navigator.language || navigator.userLanguage || ""; if (language.indexOf("-") > 0) { this[window.RW_Constants.SESSION.LANGUAGE] = language.split("-", 2)[0]; this.log("Language : " + this[window.RW_Constants.SESSION.LANGUAGE]); this[window.RW_Constants.SESSION.COUNTRY] = language.split("-", 2)[1]; this.log("Country : " + this[window.RW_Constants.SESSION.COUNTRY]); } this[window.RW_Constants.SESSION.TIME_ZONE] = new Date().getTimezoneOffset() / 60; this.log("Time-zone : " + this[window.RW_Constants.SESSION.TIME_ZONE]); this[window.RW_Constants.SESSION.SCREEN_SIZE] = ["width:", window.outerWidth, ",height:", window.outerHeight].join(""); this.log("Screen : " + this[window.RW_Constants.SESSION.SCREEN_SIZE]); this[window.RW_Constants.SESSION.DATA_SOURCE] = "Website"; this.log("Data Source : " + this[window.RW_Constants.SESSION.DATA_SOURCE]); /*** * AOS 는 Android 앱을 통해서 유입되는 데이터만 해당. * IOS 는 iOS 앱을 통해서 유입되는 데이터만 해당. * PC 는 Website ( PC & Mobile ) 를 통해서 유입되는 데이터만 해당. * 만약에 앱은 없고, 웹 사이트만 존재하는 하고, PC Web, Mobile Web을 구분하려면 프로파일을 분리하는 것으로 대응. ***/ this[window.RW_Constants.SESSION.PLATFORM] = "PC"; this.log("Platform : " + this[window.RW_Constants.SESSION.PLATFORM]); this[window.RW_Constants.SESSION.BUILD_MODE] = process.env.NODE_ENV; this.log("Deploy mode : " + this[window.RW_Constants.SESSION.BUILD_MODE]); this[window.RW_Constants.SESSION.DEBUG_MODE_STATUS] = process.env.NODE_ENV == "production" ? false : true; } catch (e) { this.error(e); } } /** * Analyze Document Cookies * @private **/ analyzingDocumentCookies() { let cookies = new Object(); try { this.log("SDK started to analyze browser cookies. "); let value = document.cookie; if (value != null && value != "") { let _arr = value.split(";"); _arr.forEach(function (element) { let v = element.trim().split("=", 2); cookies[v[0]] = v[1]; }); } this.log("Cookie result : " + JSON.stringify(cookies)); } catch (e) { this.error(e); } finally { this[window.RW_Constants.SESSION.REQUEST_COOKIE] = cookies; } } /** * Analyze Referrer ( DR ) * @private **/ analyzingReferrer(type) { try { if (window.DOT_INCLUDE_URL != null && window.DOT_INCLUDE_URL !== "") { this.log("SDK started to analyze referer. "); let needToAdInfoFromLocalStorage = true; /* check external visit status */ let ref = document.referrer; let includeRegExp = new RegExp(["(", window.DOT_INCLUDE_URL, ")"].join(""), 'gi'); if (includeRegExp.test(ref)) { this.log("The document.referrer is internal url path. Referrer analyzing skipped."); ref = ""; } /** * DR, CR 에 따라 사용될 키값 설정 ***/ let referrerKey = ""; let referrerQueryStringKey = ""; let referrerUpTimeKey = ""; if (type == window.RW_Constants.PAGE.REFERRER_STRING_FOR_WEB) { referrerKey = "referrer"; referrerQueryStringKey = "dqUrl"; referrerUpTimeKey = "referrerUpTime"; } else if (type == window.RW_Constants.PAGE.CPC_REFERRER_STRING_FOR_WEB) { referrerKey = "cpcReferrer"; referrerQueryStringKey = "cqUrl"; referrerUpTimeKey = "cpcReferrerUpTime"; /* CR 일때는 cpc 정보가 포함된 리퍼러인지 확인하고 추가 필요 ( paid 일때만 추가 ), 조건 안맞으면 공백 처리. */ let hasRequiredParameterForCpc = new RegExp(["(", "gkw|keywd|keyword|kwd|OVKEY|DMKW|NVADKWD|NVKWD|rcsite|rctype|n_keyword|DMKW", ")"].join(""), 'gi'); if (!hasRequiredParameterForCpc.test(window.top.location.href)) { this.log("The document.location.href has not requried parameter for paid ad ( CPC )"); ref = ""; } } /** * 외부 도메인에서 유입된 트래픽에 대하여 dr, dq 값을 리퍼러 유지기간 동안 유지 시키는 로직 처리. ***/ if (ref != null && ref != "") { this.setReferrerDataToSessionData(ref, window.top.location.href, type); let cIdentifyStr = window.RW_storage.getItem(window.RW_storage.CLIENT_IDENTIFY); if (cIdentifyStr != null) { let cIdentify = new SProperties(); cIdentify.putAll(JSON.parse(cIdentifyStr)); let _trackData = cIdentify["BEHAVIOR"][this[window.RW_Constants.SESSION.SERVICE_NO]]["T"]["data"]; if (_trackData != null) { _trackData[referrerKey] = ref; _trackData[referrerQueryStringKey] = window.top.location.href; _trackData[referrerUpTimeKey] = new Date().getTime(); } window.RW_storage.setItem(window.RW_storage.CLIENT_IDENTIFY, JSON.stringify(cIdentify)); } } else { let cIdentifyStr = window.RW_storage.getItem(window.RW_storage.CLIENT_IDENTIFY); if (cIdentifyStr != null) { let cIdentify = new SProperties(); cIdentify.putAll(JSON.parse(cIdentifyStr)); let _trackData = cIdentify["BEHAVIOR"][this[window.RW_Constants.SESSION.SERVICE_NO]]["T"]["data"]; if (_trackData != null) { // 저장된 값의 만료 시간 검사. let _today = new Date().getTime(); let _upTime = parseInt(_trackData[referrerUpTimeKey]); if (_today < _upTime + window.RW_timeutil.DAY * window.DOT_REFERRER_EXPIRE) { this.setReferrerDataToSessionData(_trackData[referrerKey], _trackData[referrerQueryStringKey], type); } else { delete _trackData[referrerKey]; delete _trackData[referrerQueryStringKey]; delete _trackData[referrerUpTimeKey]; window.RW_storage.setItem(window.RW_storage.CLIENT_IDENTIFY, JSON.stringify(cIdentify)); } } } } } } catch (e) { this.error(e); } } setReferrerDataToSessionData(ref, url, type) { this[type] = ref; // dmRef or cmRef this.log("Original referer (" + type + ") : " + ref); if (type == window.RW_Constants.PAGE.REFERRER_STRING_FOR_WEB) { this[window.RW_Constants.PAGE.REFERRER_QUERY_STRING_FOR_WEB] = url; // dqRef this.log("Landing Query string with Original referer (" + type + ") : " + url); if (ref != "" && ref.indexOf("?") > 0) { let _q = ref.substring(ref.indexOf("?") + 1); // const queryString = require('query-string'); const parsed = queryString.parse(_q); if (parsed != null) { this[window.RW_Constants.PAGE.REFERRER_QUERYSTRING_MAP] = JSON.stringify(parsed); this.log("Original query string : " + _q); this.log("Original query data : " + JSON.stringify(parsed)); } } } else if (type == window.RW_Constants.PAGE.CPC_REFERRER_STRING_FOR_WEB) { this[window.RW_Constants.PAGE.CPC_REFERRER_QUERY_STRING_FOR_WEB] = url; // dqRef this.log("Landing Query string with Original referer (" + type + ") : " + url); } } /*** * Whether current visit is a unique active user. * @private ***/ checkUniqueActivVisitStatus() { try { if (SDK_USEMODE != 3) { let cIdentifyStr = window.RW_storage.getItem(window.RW_storage.CLIENT_IDENTIFY); if (cIdentifyStr != null) { let cIdentify = new SProperties(); cIdentify.putAll(JSON.parse(cIdentifyStr)); let _trackData = cIdentify["BEHAVIOR"][this[window.RW_Constants.SESSION.SERVICE_NO]]["T"]["data"]; if (_trackData != null) { // isDf let isDf = _trackData[window.RW_Constants.SESSION.DAU]; if (isDf == null) { // isDf this[window.RW_Constants.SESSION.DAU] = window.RW_Constants.YES; _trackData[window.RW_Constants.SESSION.DAU] = window.RW_timeutil.getDauExpireTime(new Date()); // isWf ( Type1 ) this[window.RW_Constants.SESSION.WAU] = window.RW_Constants.YES; _trackData[window.RW_Constants.SESSION.WAU] = window.RW_timeutil.getWauExpireTime(new Date()); // isMf this[window.RW_Constants.SESSION.MAU] = window.RW_Constants.YES; _trackData[window.RW_Constants.SESSION.MAU] = window.RW_timeutil.getMauExpireTime(new Date()); // isWf ( Type2 ) this[window.RW_Constants.SESSION.WAU2] = window.RW_Constants.YES; _trackData[window.RW_Constants.SESSION.WAU2] = window.RW_timeutil.getWau2ExpireTime(new Date()); } else { let _now = new Date(); // isDf if (_trackData[window.RW_Constants.SESSION.DAU] < _now.getTime()) { this[window.RW_Constants.SESSION.DAU] = window.RW_Constants.YES; _trackData[window.RW_Constants.SESSION.DAU] = window.RW_timeutil.getDauExpireTime(new Date()); } else { this[window.RW_Constants.SESSION.DAU] = window.RW_Constants.NO; } // isWf if (_trackData[window.RW_Constants.SESSION.WAU] < _now.getTime()) { this[window.RW_Constants.SESSION.WAU] = window.RW_Constants.YES; _trackData[window.RW_Constants.SESSION.WAU] = window.RW_timeutil.getWauExpireTime(new Date()); } else { this[window.RW_Constants.SESSION.WAU] = window.RW_Constants.NO; } // isMf if (_trackData[window.RW_Constants.SESSION.MAU] < _now.getTime()) { this[window.RW_Constants.SESSION.MAU] = window.RW_Constants.YES; _trackData[window.RW_Constants.SESSION.MAU] = window.RW_timeutil.getMauExpireTime(new Date()); } else { this[window.RW_Constants.SESSION.MAU] = window.RW_Constants.NO; } // isWf ( Type2 ) if (_trackData[window.RW_Constants.SESSION.WAU2] < _now.getTime()) { this[window.RW_Constants.SESSION.WAU2] = window.RW_Constants.YES; _trackData[window.RW_Constants.SESSION.WAU2] = window.RW_timeutil.getWau2ExpireTime(new Date()); } else { this[window.RW_Constants.SESSION.WAU2] = window.RW_Constants.NO; } } window.RW_storage.setItem(window.RW_storage.CLIENT_IDENTIFY, JSON.stringify(cIdentify)); } } } } catch (e) { this.error(e); } } /** * Update LTVT, LTVI, UDVT data into local storage. * @private **/ updateVisitCountData() { try { let cIdentifyStr = window.RW_storage.getItem(window.RW_storage.CLIENT_IDENTIFY); if (cIdentifyStr != null) { let cIdentify = new SProperties(); cIdentify.putAll(JSON.parse(cIdentifyStr)); let _behaviorData = cIdentify["BEHAVIOR"][this[window.RW_Constants.SESSION.SERVICE_NO]]["T"]["data"]; if (_behaviorData != null) { let ltvi = parseInt(_behaviorData[window.RW_Constants.SESSION.LTVI]); let tmpVisitInterval = 0; if (typeof _behaviorData["tmpVisitInterval"] != "undefined") { tmpVisitInterval = parseInt(_behaviorData["tmpVisitInterval"]); } let ltvt = parseInt(_behaviorData[window.RW_Constants.SESSION.LTVT]); let udvt = parseInt(_behaviorData[window.RW_Constants.SESSION.UDVT]); ltvt++; if (tmpVisitInterval >= DOP_SDK_CONF.combackUserLimitDays) { udvt = 1; } else { udvt++; } ltvi += tmpVisitInterval; let ltRvnVt = parseInt(_behaviorData[window.RW_Constants.SESSION.LTRVNVT]); ltRvnVt++; _behaviorData[window.RW_Constants.SESSION.LTVT] = ltvt; _behaviorData[window.RW_Constants.SESSION.LTVI] = ltvi; _behaviorData[window.RW_Constants.SESSION.UDVT] = udvt; _behaviorData[window.RW_Constants.SESSION.LTRVNVT] = ltRvnVt; _behaviorData["tmpVisitInterval"] = 0; window.RW_storage.setItem(window.RW_storage.CLIENT_IDENTIFY, JSON.stringify(cIdentify)); } } } catch (e) { this.error(e); } } /** * Session expire check * @private **/ lasestSessionCheck() { try { this.log("SDK started to check latest session."); var _nowDate = new Date(); var _nowTime = _nowDate.getTime(); let _service = new ServiceIdentify(this[window.RW_Constants.SESSION.SERVICE_NO]); let _behavior = new ServiceIdentify(this[window.RW_Constants.SESSION.SERVICE_NO]); let cIdentifyStr = window.RW_storage.getItem(window.RW_storage.CLIENT_IDENTIFY); if (cIdentifyStr == null) { this.log("SDK had cannot find latest session."); // New User _service.set("value", window.RW_generator.SID()); _service.set("limitTime", window.RW_Constants.sessionIntervalTime); _service.set("createTime", _nowTime); _service.set("latestTickTime", _nowTime); _service.set("pageKey", 0); _service.set("previousPageVisitTime", 0); _service.set("fdp", window.top.location.href); let cIdentify = new SProperties().set("UUID", new SProperties().set("value", window.RW_generator.UUID()).set("createTime", _nowTime)).set("SID", new SProperties().set(_service.serviceNo, _service.data)).set("updateTime", _nowTime); // DOT sequence & behavior tracking data let _tBehavior = new TBehavior(); _tBehavior.set(window.RW_Constants.SESSION.LTVT, 0); _tBehavior.set(window.RW_Constants.SESSION.UDVT, 0); _tBehavior.set(window.RW_Constants.SESSION.LTVI, 0); _tBehavior.set(window.RW_Constants.SESSION.LTRVNC, 0); _tBehavior.set(window.RW_Constants.SESSION.LTRVN, 0); _tBehavior.set(window.RW_Constants.SESSION.UDRVNC, 0); _tBehavior.set(window.RW_Constants.SESSION.LTRVNI, 0); _tBehavior.set(window.RW_Constants.SESSION.LTRVNVT, 0); _tBehavior.set(window.RW_Constants.SESSION.LAST_ORD_NO, ""); _tBehavior.set(window.RW_Constants.SESSION.LAST_ORD_TIME, 0); _behavior.set("T", _tBehavior); cIdentify.set("BEHAVIOR", new SProperties().set(_behavior.serviceNo, _behavior.data)); window.RW_storage.setItem(window.RW_storage.CLIENT_IDENTIFY, JSON.stringify(cIdentify)); this.log("SDK had created a new session and write into local storage."); // uuid, sid, userId set this[window.RW_Constants.SESSION.UUID] = cIdentify["UUID"]["value"]; this[window.RW_Constants.SESSION.SID] = cIdentify["SID"][this[window.RW_Constants.SESSION.SERVICE_NO]]["value"]; this[window.RW_Constants.SESSION.FIRST_LANDING_URL] = window.top.location.href; this.log("New UUID : " + this[window.RW_Constants.SESSION.UUID]); this.log("New SID : " + this[window.RW_Constants.SESSION.SID]); this.isVisitNew = "Y"; } else { thi