astec-consumer.motenasu.biz
Open in
urlscan Pro
133.223.66.41
Public Scan
URL:
https://astec-consumer.motenasu.biz/scripts/jquery.unknown.marketing.js
Submission: On February 03 via manual from IN — Scanned from JP
Submission: On February 03 via manual from IN — Scanned from JP
Form analysis
0 forms found in the DOMText Content
/** * @var å„種パラメータã®å–得用é…列 */ var params = {}; /** * @var MOTENASUリード特定用ã®ãƒˆãƒ¼ã‚¯ãƒ³ */ var loginkey = null; /** * @var URLã®å–å¾— */ params.requestUrl = location.href; /** * @var COOKIEパラメータå */ params.cookieName = "mt_uid"; /** * @var クッã‚ãƒ¼æœ‰åŠ¹æœŸé™ */ params.maxage = 63072000; // 2å¹´ /** * @var 呼ã³å‡ºã—å´ã§è¨å®šã•ã‚ŒãŸå¤‰æ•° */ params.opt = window._motenasuOpt; /** * @var 呼ã³å‡ºã—å´ã§è¨å®šã•ã‚ŒãŸã‚»ã‚°ãƒ¡ãƒ³ãƒˆå¤‰æ•° */ params.segment = window._motenasuSegment; /** * @var 通信プãƒãƒˆã‚³ãƒ« */ params.protocol = /^https/.test(params.opt.siteDomain) ? "https" : "http"; /** * @var ホストå */ params.hostname = window.location.hostname; /** * @var 訪å•æ™‚é–“ */ var startTime = 0; /** * @var 離脱時間 */ var endTime = 0; /** * @var 匿å顧客ID */ var uuid = null; /** * @var å±¥æ´ID */ var historyId = null; /** * @var åŒæœŸã‚¹ãƒ†ãƒ¼ã‚¿ã‚¹ãƒ•ãƒ©ã‚° */ var isAsync = true; /** * @var ユーザエージェント */ var ua = window.navigator.userAgent; // 訪å•æ™‚間を記録 startTime = (new Date()).getTime(); // loginkeyã®å–å¾— var matches = location.href.match(/loginkey\=([0-9a-zA-Z]+)/); if(matches !== null) loginkey = matches[1]; // COOKIEã®å–å¾— var cookies = document.cookie; var cookiesArray = cookies.split(';'); var cookieValue; for(var i = 0; i < cookiesArray.length; i++){ var cArray = cookiesArray[i].split('='); if(cArray[0].trim() == params.cookieName){ cookieValue = cArray[1].trim(); } } // COOKIEãŒãªã‘ã‚Œã°ã€æ–°è¦ç™»éŒ² if(typeof cookieValue === "undefined" || cookieValue === "null") { setUniqueValueOnCookie(); } else { // MOTENASUã®DBã«åŒæœŸã—ã¾ã™ã€‚ asyncUnknownUser(cookieValue); } var visibilityChange; if (typeof document.hidden !== "undefined") { visibilityChange = "visibilitychange"; } else if (typeof document.mozHidden !== "undefined") { visibilityChange = "mozvisibilitychange"; } else if (typeof document.msHidden !== "undefined") { visibilityChange = "msvisibilitychange"; } else if (typeof document.webkitHidden !== "undefined") { visibilityChange = "webkitvisibilitychange"; } // ページé·ç§»ã‚„更新時ã«ç™ºå‹•ã—ã¾ã™ã€‚ window.addEventListener("pagehide", action, false); // android端末ã§ãƒ–ラウザを閉ã˜ã‚‹ã€ã‚¿ãƒ–ã‚’é–‰ã˜ã‚‹æ™‚ã«ç™ºå‹•ã—ã¾ã™ã€‚ window.addEventListener(visibilityChange, action, false); // ※iphone,ipadã®ãƒ–ラウザを閉ã˜ã‚‹ã€ã‚¿ãƒ–ã‚’é–‰ã˜ã‚‹å‹•ä½œã®éš›ã¯ã‚¤ãƒ™ãƒ³ãƒˆã®å–å¾—ãŒå‡ºæ¥ãªã„為ã€éžå¯¾å¿œã§ã™ã€‚ //ブラウザã®ãƒšãƒ¼ã‚¸å±¥æ´ã‚¹ãƒ†ãƒ¼ãƒˆã«å€¤ã‚’付与ã—ã¾ã™ window.history.pushState({page: 1}, "", ""); function action() { // クッã‚ーデータやアンノウンユーザーデータã®åŒæœŸã«æˆåŠŸã—ã¦ã„れ㰠if(isAsync) { // 離脱時間を記録 endTime = (new Date()).getTime(); // 滞在時間をå–å¾—ã—ã¾ã™ã€‚ duration = getDuration(startTime, endTime); // タイムアウト値ã«é”ã—ã¦ã„ãªã‘れ㰠if(params.opt.timeout >= duration) { // Ajax通信を行ã„ã¾ã™ã€‚ ブラウザ毎ã«Ajaxæ–¹å¼ã‚’変更ã—ã¾ã™ã€‚ if((/MSIE/.test(ua)) || (/Trident/.test(ua))) { var xhr = new XMLHttpRequest(); xhr.open("post", params.opt.siteDomain + "/api/marketing/unknownuser/update/duration/" + historyId, false); xhr.responseType = 'json'; xhr.onload = function (e) { if (xhr.readyState === 4) { if (xhr.status !== 200) { console.log("error of api program."); } } }; var data = new FormData(); data.append("duration",duration); data.append("apikey",params.opt.apikey); data.append("ipAddr",params.opt.ipAddr); xhr.send(data); } else { var data = new FormData(); data.append('duration', duration); data.append('apikey', params.opt.apikey); data.append('ipAddr', params.opt.ipAddr); navigator.sendBeacon(params.opt.siteDomain + "/api/marketing/unknownuser/update/duration/" + historyId, data); } } } return; } /** * 一æ„ã®å€¤ã‚’å–å¾—ã—ã¾ã™ã€‚ * @return 一æ„ã®å€¤ */ function setUniqueValueOnCookie() { var result = null var str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" var length = 60; var value = ""; for (var i = 0; i < length; i++){ value+=str[Math.floor(Math.random()*str.length)]; } //Cookieã‚’ä¿å˜ document.cookie = params.cookieName + "=" + value + "; path=/; max-age=" + params.maxage; // MOTENASUã®ãƒ‡ãƒ¼ã‚¿ãƒ™ãƒ¼ã‚¹ã«åŒæœŸã—ã¾ã™ã€‚ asyncUnknownUser(value); } /** * UnknownUserデータをMOTENASUã«åŒæœŸã—ã¾ã™ã€‚ * @param uid 一æ„ã®ã‚¯ãƒƒã‚ー値 */ function asyncUnknownUser(uid) { //セグメント群 var segmentParam = {}; var segmentData = {}; var i = 0; for(key in params.segment) { segmentParam[i] = key; segmentData[i] = params.segment[key]; i++; } var itemIds = {}; var i = 0; for(key in params.opt.itemIds) { itemIds[i] = params.opt.itemIds[key]; i++; } // Ajax通信を行ã„ã¾ã™ã€‚ var xhr = new XMLHttpRequest(); xhr.open("post", params.opt.siteDomain + "/api/marketing/unknownuser/update/" + uid, false); xhr.onload = function (e) { if (xhr.readyState === 4) { if (xhr.status === 200) { try { // 返り値をセットã—ã¾ã™ã€‚ var resText = JSON.parse(this.responseText || "null"); uuid = resText.uuid; historyId = resText.historyId; // IP制é™å¯¾è±¡ã®å ´åˆ } catch (e){ isAsync = false; console.log("Invalid IP address."); } } else { isAsync = false; console.log("error of api program."); } } }; var metaKeywords = document.getElementsByTagName('meta')["keywords"]; if (metaKeywords !== undefined) { metaKeywords = document.getElementsByTagName('meta')["keywords"].content; } else { metaKeywords = ''; } var data=new FormData(); data.append("apikey",params.opt.apikey); data.append("requestUrl",params.opt.requestUrl); data.append("title",params.opt.title); data.append("metaKeywords",metaKeywords); data.append("referrer",params.opt.referrer); data.append("userAgent",params.opt.userAgent); data.append("ipAddr",params.opt.ipAddr); data.append("hostname",params.hostname); data.append("outsideId",params.opt.userId); data.append("segmentParam",segmentParam); data.append("segmentData",segmentData); data.append("loginkey",loginkey); data.append("itemIds",itemIds); xhr.send(data); } /** * 滞在時間を返å´ã—ã¾ã™ã€‚<br> * å°æ•°ç‚¹ä»¥ä¸‹ã¯åˆ‡ã‚Šæ¨ã¦ * @param startTime 訪å•æ™‚é–“ * @param endTime 離脱時間 * @returns 滞在時間 */ function getDuration(startTime, endTime) { return Math.floor((endTime - startTime) / 1000); }