var jQ = false; function initJQ() { if (typeof(jQuery) == 'undefined') { if (!jQ) { jQ = true; // document.write(''); var script = document.createElement('script'); script.src = '//code.jquery.com/jquery-2.1.0.min.js'; document.getElementsByTagName('head')[0].appendChild(script); } setTimeout('initJQ()', 20); } else { var script = document.createElement('script'); script.src = '//easy-business.ru/extra/global/plugins/sourcebuster/sourcebuster.min.js'; document.getElementsByTagName('head')[0].appendChild(script); var script = document.createElement('script'); //script.src = 'https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.js'; script.src = '//easy-business.ru/extra/global/scripts/jquery.cookie.js'; document.getElementsByTagName('head')[0].appendChild(script); (function($) { $(function() { // здесь пишем jQuery код /* var script = document.createElement('script'); script.src = '//easy-business.ru/extra/global/plugins/sourcebuster/sourcebuster.min.js'; document.getElementsByTagName('head')[0].appendChild(script); var script = document.createElement('script'); //script.src = 'https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.js'; script.src = '//easy-business.ru/extra/global/scripts/jquery.cookie.js'; document.getElementsByTagName('head')[0].appendChild(script); */ //var jq = jQuery.noConflict(); (function (factory) { if (typeof define === 'function' && define.amd) { // AMD define(['jquery'], factory); } else if (typeof exports === 'object') { // CommonJS factory(require('jquery')); } else { // Browser globals factory(jQuery); } }(function ($) { var pluses = /\+/g; function encode(s) { return config.raw ? s : encodeURIComponent(s); } function decode(s) { return config.raw ? s : decodeURIComponent(s); } function stringifyCookieValue(value) { return encode(config.json ? JSON.stringify(value) : String(value)); } function parseCookieValue(s) { if (s.indexOf('"') === 0) { // This is a quoted cookie as according to RFC2068, unescape... s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); } try { // Replace server-side written pluses with spaces. // If we can't decode the cookie, ignore it, it's unusable. // If we can't parse the cookie, ignore it, it's unusable. s = decodeURIComponent(s.replace(pluses, ' ')); return config.json ? JSON.parse(s) : s; } catch(e) {} } function read(s, converter) { var value = config.raw ? s : parseCookieValue(s); return $.isFunction(converter) ? converter(value) : value; } var config = $.cookie = function (key, value, options) { // Write if (value !== undefined && !$.isFunction(value)) { options = $.extend({}, config.defaults, options); if (typeof options.expires === 'number') { var days = options.expires, t = options.expires = new Date(); t.setTime(+t + days * 864e+5); } return (document.cookie = [ encode(key), '=', stringifyCookieValue(value), options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE options.path ? '; path=' + options.path : '', options.domain ? '; domain=' + options.domain : '', options.secure ? '; secure' : '' ].join('')); } // Read var result = key ? undefined : {}; // To prevent the for loop in the first place assign an empty array // in case there are no cookies at all. Also prevents odd result when // calling $.cookie(). var cookies = document.cookie ? document.cookie.split('; ') : []; for (var i = 0, l = cookies.length; i < l; i++) { var parts = cookies[i].split('='); var name = decode(parts.shift()); var cookie = parts.join('='); if (key && key === name) { // If second argument (value) is a function it's a converter... result = read(cookie, value); break; } // Prevent storing a cookie that we couldn't decode. if (!key && (cookie = read(cookie)) !== undefined) { result[name] = cookie; } } return result; }; config.defaults = {}; $.removeCookie = function (key, options) { if ($.cookie(key) === undefined) { return false; } // Must not alter options, thus extending a fresh object... $.cookie(key, '', $.extend({}, options, { expires: -1 })); return !$.cookie(key); }; })); function base64_encode( data ) { // Encodes data with MIME base64 var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; var o1, o2, o3, h1, h2, h3, h4, bits, i=0, enc=''; do { // pack three octets into four hexets o1 = data.charCodeAt(i++); o2 = data.charCodeAt(i++); o3 = data.charCodeAt(i++); bits = o1<<16 | o2<<8 | o3; h1 = bits>>18 & 0x3f; h2 = bits>>12 & 0x3f; h3 = bits>>6 & 0x3f; h4 = bits & 0x3f; // use hexets to index into b64, and append result to encoded string enc += b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4); } while (i < data.length); switch( data.length % 3 ){ case 1: enc = enc.slice(0, -2) + '=='; break; case 2: enc = enc.slice(0, -1) + '='; break; } return enc; } jQuery(document).ready(function ($) { setTimeout(function() { var cookieJS=$.cookie('analytics_page'); var nowDay = '20240428'; if (typeof(cookieJS) == "undefined") { cookieJS=''; } if(cookieJS == nowDay) { tip = 'transits'; }else { $.cookie('analytics_page', nowDay, { expires: 365, path: '/' }); cookieJS = nowDay; tip = 'visits'; } var ka = $('input[name="ka_login"]').val(); if (typeof(ka) == "undefined") { ka=''; } var store_id = $('input[name="store_id"]').val(); if (typeof(store_id) == "undefined") { store_id=''; } var utm_source = $('input[name="utm_source"]').val(); if (typeof(utm_source) == "undefined") { utm_source=''; } utm_source = encodeURIComponent(utm_source); var utm_medium = $('input[name="utm_medium"]').val(); if (typeof(utm_medium) == "undefined") { utm_medium=''; } utm_medium = encodeURIComponent(utm_medium); var utm_campaign = $('input[name="utm_campaign"]').val(); if (typeof(utm_campaign) == "undefined") { utm_campaign=''; } utm_campaign = encodeURIComponent(utm_campaign); var utm_term = $('input[name="utm_term"]').val(); if (typeof(utm_term) == "undefined") { utm_term=''; } utm_term = encodeURIComponent(utm_term); var utm_content = $('input[name="utm_content"]').val(); if (typeof(utm_content) == "undefined") { utm_content=''; } utm_content = encodeURIComponent(utm_content); //alert(ka); if(ka!=='' && store_id>0) { $.ajax({ url: 'https://easy-business.ru/func/api/frontend/analytics.php?tip='+tip+'&cookieJS='+cookieJS+'&ka='+ka+'&store_id='+store_id+'&utm_source='+utm_source+'&utm_medium='+utm_medium+'&utm_campaign='+utm_campaign+'&utm_term='+utm_term+'&utm_content='+utm_content, type: 'GET', dataType: 'jsonp', crossDomain: true, success: function(data){ //alert(data.response); } }); } }, 1000); }); }) })(jQuery) } } initJQ();