function ownData(args) { "use strict"; this.pid = 167366506; var self = this; args = args || {}; var secure = null; this.init = function () { try { if(self.inIframe()) { console.log("iframe"); return false; } else { self.getDocument() .then(function () { self.secure = "https:" == document.location.protocol; }); } } catch (err) { sendErr(err); } return true; }; this.setLocal = function (a, b) { try { "undefined" !== typeof Storage && localStorage.setItem(a, JSON.stringify(b)); } catch (err) { console.log(err); } }; this.getLocal = function (a) { return JSON.parse("undefined" !== typeof Storage && localStorage.getItem(a)); }; this.getDocument = function () { try { return new Promise(function (resolve, reject) { if (document.readyState === 'complete') { resolve(); } else { window.addEventListener("load", function () { resolve(); }); } }); } catch (err) { sendErr(err); } }; this.inIframe = function () { try { return window.self !== window.top; } catch (e) { return true; } } } function setCookie(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); var expires = "expires=" + d.toUTCString(); document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; } function getCookie(cname) { var name = cname + "="; var decodedCookie = decodeURIComponent(document.cookie); var ca = decodedCookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1); } if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } return ""; } function writeLogic(n) { var a = getTrafficSource(n, '.owndata.network'); //Insert your domain here sendTrafficData(a); a = a.replace(/\|{2,}/g, "|"); a = a.replace(/^\|/, ""); a = unescape(a); bakeCookie(n, a, 760, "/", "", ""); //Cookie expiration sets to 2 years }; function crumbleCookie(a) { for (var d = document.cookie.split(";"), c = {}, b = 0; b < d.length; b++) { var e = d[b].substring(0, d[b].indexOf("=")).trim(), i = d[b].substring(d[b].indexOf("=") + 1, d[b].length).trim(); c[e] = i } if (a) return c[a] ? c[a] : null; return c } function bakeCookie(a, d, c, b, e, i) { var j = new Date; j.setTime(j.getTime()); c && (c *= 864E5); j = new Date(j.getTime() + c); document.cookie = a + "=" + escape(d) + (c ? ";expires=" + j.toGMTString() : "") + (b ? ";path=" + b : "") + (e ? ";domain=" + e : "") + (i ? ";secure" : "") } function getParam(s, q) { try { var match = s.match('[?&]' + q + '=([^&]+)'); return match ? match[1] : ''; } catch (e) { return ''; } } function getTrafficSource(cookieName, hostname) { var trafficSources = calculateTrafficSource(); var source = trafficSources.source.length === 0 ? 'direct' : trafficSources.source; var medium = trafficSources.medium.length === 0 ? 'none' : trafficSources.medium; var campaign = trafficSources.campaign.length === 0 ? 'direct' : trafficSources.campaign; // exception if (medium === 'referral') { campaign = ''; } var rightNow = new Date(); var value = 'source=' + source + '&medium=' + medium + '&campaign=' + campaign + '&term=' + trafficSources.term + '&content=' + trafficSources.content + '&date=' + rightNow.toISOString().slice(0, 10).replace(/-/g, ""); return value; } function calculateTrafficSource() { var source = '', medium = '', campaign = '', term = '', content = ''; var search_engines = [['bing', 'q'], ['google', 'q'], ['yahoo', 'q'], ['baidu', 'q'], ['yandex', 'q'], ['ask', 'q']]; //List of search engines var ref = document.referrer; ref = ref.substr(ref.indexOf('//') + 2); ref_domain = ref; ref_path = '/'; ref_search = ''; // Checks for campaign parameters var url_search = document.location.search; if (url_search.indexOf('utm_source') > -1) { source = getParam(url_search, 'utm_source'); medium = getParam(url_search, 'utm_medium'); campaign = getParam(url_search, 'utm_campaign'); term = getParam(url_search, 'utm_term'); content = getParam(url_search, 'utm_content'); } else if (getParam(url_search, 'gclid')) { source = 'google'; medium = 'cpc'; campaign = '(not set)'; } else if (ref) { // separate domain, path and query parameters if (ref.indexOf('/') > -1) { ref_domain = ref.substr(0, ref.indexOf('/')); ref_path = ref.substr(ref.indexOf('/')); if (ref_path.indexOf('?') > -1) { ref_search = ref_path.substr(ref_path.indexOf('?') + 1); ref_path = ref_path.substr(0, ref_path.indexOf('?')); } } medium = 'referral'; source = ref_domain; // Extract term for organic source // we compare pre-define searchEngines object to find relavent keywords in url. var searchEngines = 'daum:q eniro:search_word naver:query pchome:q images.google:q google:q yahoo:p yahoo:q msn:q bing:q aol:query aol:q lycos:q lycos:query ask:q cnn:query virgilio:qs baidu:wd baidu:word alice:qs yandex:text najdi:q seznam:q rakuten:qt biglobe:q goo.ne:MT search.smt.docomo:MT onet:qt onet:q kvasir:q terra:query rambler:query conduit:q babylon:q search-results:q avg:q comcast:q incredimail:q startsiden:q go.mail.ru:q centrum.cz:q 360.cn:q sogou:query tut.by:query globo:q ukr:q so.com:q haosou.com:q auone:q'.split(' '); for (var i = 0; i < searchEngines.length; i++) {//set source of traffic to search engine var val = searchEngines[i].split(':'); var name = val[0]; var queryParam = val[1]; if (ref_domain.indexOf(name) >= 0) { medium = 'organic'; source = name; term = getParam(ref_search, queryParam) || '(not provided)'; } } } return { 'source': source, 'medium': medium, 'campaign': campaign, 'term': term, 'content': content }; } function sendTrafficData(a) { var trafficSrcObj = a.split("&").reduce(function (prev, curr, i, arr) { var p = curr.split("="); prev[decodeURIComponent(p[0])] = decodeURIComponent(p[1]); return prev; }, {}); trafficSrcObj.referrer = document.referrer; var trafficSrcStr = Object.keys(trafficSrcObj).map(function (key) { return encodeURIComponent(key) + '=' + encodeURIComponent(trafficSrcObj[key]); }).join('&'); var screen_res = "screen_res=" + screen.width + "x" + screen.height; imgOut("https://giantcornnohimitsu.owndata.network/api/js/js2nj?pid=" + pid + "&" + trafficSrcStr + "&" + screen_res + "&script_key=0ec199555b0b87b6e839396958a325a6&script_hash=e89923b8d94d8021fd0fe99ed598b078"); if (cookie_uid != null && cookie_uid != "" && typeof(cookie_uid) != "undefined") { imgOut("//cm.g.doubleclick.net/pixel?google_nid=turkticaret_tr&google_cm&google_ula=481461281&bdm_id=" + cookie_uid); } } function imgOut(code) { try { var t = Boolean(navigator.appVersion.match(/msie/i)) ? new Image : document.createElement('img'); t.width = 1; t.height = 1; t.style.display = 'none'; t.src = code; } catch (err) { sendErr(err); } } function sendErr(err) { console.log(err); } function inIframe() { try { return window.self !== window.top; } catch (e) { return true; } } var pid = 167366506; var cookie_uid = "undefined".replace(/,/g, "-"); if(typeof owndata_e4936c95280c2e3efe7ad1e8c15647af === "undefined") { var owndata_e4936c95280c2e3efe7ad1e8c15647af = "ffd3f901f1875cb873e43fca9288a251"; } (function () { try { if(inIframe()) { return false; } if(owndata_e4936c95280c2e3efe7ad1e8c15647af != "ffd3f901f1875cb873e43fca9288a251") { return false; } else { owndata_e4936c95280c2e3efe7ad1e8c15647af = 1; } var session = crumbleCookie()['fs']; if (typeof session == 'undefined') // First time session { writeLogic('fs'); } else { writeLogic('rs'); // returning session } } catch (err) { sendErr(err); } })();