if (typeof adec_AlreadyDisplayedBar !== 'undefined' && adec_AlreadyDisplayedBar==1)
{
//do nothing, already the bar is loaded (sometimes, strangely, the scripttag is called multiple times)
}
else
{
var adec_AlreadyDisplayedBar=1;
var canTrack=0;
window.Shopify.loadFeatures(
[
{
name: 'consent-tracking-api',
version: '0.1',
},
],
error => {
if (error) {
console.log("Content blocker extension in the browser prevented cookie permission evaluation ¯\_(ツ)_/¯");
//canTrack=1;
// throw error;
}
},
);
(function () {
//console.log('inSites starting');
function areCookiesEnabled() {
if (canTrack || !window.Shopify.customerPrivacy || window.Shopify.customerPrivacy.analyticsProcessingAllowed()) {
//|| window.Shopify.customerPrivacy.userCanBeTracked()
document.cookie = "__adec-verify=1";
var supportsCookies = document.cookie.length >= 1 &&
document.cookie.indexOf("__adec-verify=1") !== -1;
var ast = new Date(1976, 8, 16);
document.cookie = "__adec-verify=1;expires=" + thePast.toUTCString();
if (supportsCookies)
{
//console.log("Supports cookies");
return 1;
}
else
{
return 0;
}
}
else
{
console.log("No can track ¯\_(ツ)_/¯");
return 0;
}
}
function getCookie(name) {
var v = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
return v ? v[2] : "";
}
function adecRetrieveVar(varName)
{
//Retrieves variable value from the AJAX-returned string
var n=1;
var s=1;
if (n = adecStr.indexOf(varName+"='"))
{
if (s = adecStr.indexOf("';", n + varName.length + 2))
{
return(adecStr.substring(n + varName.length + 2, s));
}
}
return("");
}
function loadjscssfile(filename, filetype) {
if (filetype == "js") { //if filename is a external JavaScript file
// alert('called');
var fileref = document.createElement('script')
fileref.setAttribute("type", "text/javascript")
fileref.setAttribute("src", filename)
//alert('called');
} else if (filetype == "css") { //if filename is an external CSS file
var fileref = document.createElement("link")
fileref.setAttribute("rel", "stylesheet")
fileref.setAttribute("type", "text/css")
fileref.setAttribute("href", filename)
}
if (typeof fileref != "undefined")
document.getElementsByTagName("head")[0].appendChild(fileref)
}
function loadScript( url, callback ) {
var shouldDoRest=true;
if (url=="https://code.jquery.com/jquery-3.4.1.slim.min.js")
{
shouldDoRest=false;
if (window.jQuery) {
// jQuery is loaded
callback();
} else
if ((typeof jQuery === 'undefined') || (typeof jQuery.fn === 'undefined') || (parseFloat(jQuery.fn.jquery) < 1.9)) {
// jQuery is not loaded or not recent
shouldDoRest=true;
}
else
{
callback();
}
}
if (shouldDoRest)
{
var script = document.createElement( "script" )
script.type = "text/javascript";
document.getElementsByTagName("head")[0].appendChild( script );
if(script.readyState) { // only required for IE <9
script.onreadystatechange = function() {
if ( script.readyState === "loaded" || script.readyState === "complete" ) {
script.onreadystatechange = null;
callback();
}
};
} else { //Others
script.onload = function() {
//const myTimeoutCb = setTimeout(callback, 10);
callback();
};
}
script.src = url;
}
}
function exists(elementId)
{
var element = document.getElementById(elementId);
if (typeof(element) != 'undefined' && element != null)
{
return(true);
}
return(false);
}
function displayTheBar() {
adecStr=this.responseText;
var n=1;
var s=1;
var adeclsadmin=adecRetrieveVar('adeclsadmin');
window.iipath=adecRetrieveVar('iipath');
if(adeclsadmin==true || adeclsadmin=='true')
{
//he is admin, display the bar
//console.log('inSites: admin; display the bar');
//Find out data about the current page in client's browser
window.adecID='';
window.adecType='';
if (typeof __st === "undefined") {
//alert ("Nu exista variabila __st!");
}
else
{
if (typeof __st.p !="undefined")
window.adecType =__st.p;
if (typeof __st.rid !="undefined")
window.adecID = __st.rid;
//else if (typeof __st.u !="undefined")
//theID = __st.u;
}
//first load support files
loadScript("https://code.jquery.com/jquery-3.4.1.slim.min.js", function() {
var $=window.jQuery; //sometimes after refresh this does not happen automatically
loadjscssfile("https://TheSimpleShop.com/InSites/Fixed/css/components.css","css");
loadjscssfile("https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css","css");
loadjscssfile("https://TheSimpleShop.com/InSites/Fixed/css/adec-ii.css.php","css");
loadjscssfile("https://TheSimpleShop.com/InSites/Fixed/css/css-loading-spinners.css","css");
loadScript("https://TheSimpleShop.com/InSites/Fixed/js/d3/d3.min.js", function() {
loadScript("https://TheSimpleShop.com/InSites/Fixed/js/d3/d3_tooltip.js", function() {
loadScript("https://TheSimpleShop.com/InSites/Fixed/js/c3/c3.min.js", function() {
loadScript("https://cdn.jsdelivr.net/npm/moment@2.27.0/min/moment.min.js", function() {
loadScript("https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js", function() {
loadScript("https://TheSimpleShop.com/InSites/Fixed/js/adec-ii.js", function() {
//then the Show button for when it is hidden
var adecShowButton = document.createElement("button");
adecShowButton.id="adecShowButton";
adecShowButton.classList.add("adec-hidden");
adecShowButton.classList.add("adec-show-button");
adecShowButton.style.display="none";
adecShowButton.innerHTML='';
document.body.insertBefore(adecShowButton, document.body.firstChild);
//Change the elements with positioning fixed to absolute to fix the overlapping of the bar over the fixed top menu
//Except for the one having class "cart-widget-side" which must not be changed (or the cart will appear to the right)
//Also added exception for mm-spn which is the mobile menu ul for femmeconnection.com.au
var elems = document.body.getElementsByTagName("*");
var len = elems.length
for (var i=0;i howManyIsEnough) {
if (oldParent.childNodes[howManyIsEnough].id=="dummy-chat-button-iframe")
{ howManyIsEnough++; }
else
{ newParent.appendChild(oldParent.childNodes[howManyIsEnough]); }
}
//Then add the bar
var adecIIBar = document.createElement("div");
adecIIBar.id="adecIIBar";
adecIIBar.onscroll = function(e) {saveScroll();};
adecIIBar.classList.add("adec-ii-bar");
adecIIBar.style.height="0px";
document.body.insertBefore(adecIIBar, document.body.firstChild);
adecIIBar.innerHTML=`
vs.
+53.6%
Lorem Ipsum
Error Sales
Orders 0 Pcs
-13.4%
369,744
Visits to this pagePage Views
282,122 Visitors
-31.1%
0.71%
Percent of sessions convertedConversion Rate
2.38% Cart 1.09% C/O
+53.6%
32,450,332
Sales minus COGSGross Profit
21.3% Gross Margin
-33
759 / 24,210
Position in total salesRanking
🔥 Hot Product +23%
`;
var prevPass = getCookie("adecIIP");
loadScript("/apps/InSites/sec.js.php?prevPass=" + prevPass + "&bid=" + bid, function() {
if (adecPass!=prevPass)
{
if (canTrack || !window.Shopify.customerPrivacy || window.Shopify.customerPrivacy.analyticsProcessingAllowed()) {
var d = new Date();
d.setTime(d.getTime() + 10800000); //three hours
var expires = "expires="+ d.toUTCString();
document.cookie = "adecIIP=" + adecPass + "; " + expires + "; path=/; SameSite=None; Secure";
}
}
window.adecPass=adecPass;
document.getElementById("adecShowButton").addEventListener("click",function(){adecShow();});
document.getElementById("adecIIBar").addEventListener('mouseenter', function(){toggleBottom(1);});
document.getElementById("adecIIBar").addEventListener('mouseleave', function(){toggleBottom(0);});
document.getElementById("adecIIBar").addEventListener("click",function(){toggleBottom(-1);});
var start = moment();
var end = start;
var range="Today";
if (startCookie=getCookie('adecIIStart'))
{
//alert(startCookie);
range=getCookie('adecIIRange');
switch(range)
{
case "Today":
break;
case "Yesterday":
start=moment().subtract(1, 'days');
end=start;
break;
case 'Last 7 Days':
start=moment().subtract(7, 'days');
end=moment().subtract(1, 'days');
break;
case 'Last 30 Days':
start=moment().subtract(30, 'days');
end=moment().subtract(1, 'days');
break;
case 'Last 90 Days':
start=moment().subtract(90, 'days');
end=moment().subtract(1, 'days');
break;
case 'Last Month':
start=moment().subtract(1, 'month').startOf('month');
end=moment().subtract(1, 'month').endOf('month');
break;
case 'Last Quarter':
start=moment().startOf('quarter').subtract(1,'day').startOf('quarter');
end=moment().startOf('quarter').subtract(1, 'day');
break;
case 'Last Year':
start=moment().subtract(1, 'year').startOf('year');
end=moment().subtract(1, 'year').endOf('year');
break;
case 'Week To Date':
start=moment().startOf('isoWeek');
end=moment();
break;
case 'Month To Date':
start=moment().startOf('month');
end=moment();
break;
case 'Quarter To Date':
start=moment().startOf('quarter');
end=moment();
break;
case 'Year To Date':
start=moment().startOf('year');
end=moment();
break;
case 'All Time':
start=moment().startOf('year').subtract(19, 'years');
end=moment();
break;
default:
start=moment.unix(startCookie/1000);
end=moment.unix(getCookie('adecIIEnd')/1000);
break;
}
}
window.jQuery('#adec-date-interval').daterangepicker({
startDate: start,
endDate: end,
locale: {
"firstDay": 1
},
ranges: {
'Today': [moment(), moment()],
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
'Last 7 Days': [moment().subtract(7, 'days'), moment().subtract(1, 'days')],
'Last 30 Days': [moment().subtract(30, 'days'), moment().subtract(1, 'days')],
'Last 90 Days': [moment().subtract(90, 'days'), moment().subtract(1, 'days')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')],
'Last Quarter': [moment().startOf('quarter').subtract(1,'day').startOf('quarter'),moment().startOf('quarter').subtract(1, 'day')],
'Last Year': [moment().subtract(1, 'year').startOf('year'), moment().subtract(1, 'year').endOf('year')],
'Week To Date': [moment().startOf('isoWeek'), moment()],
'Month To Date': [moment().startOf('month'), moment()],
'Quarter To Date': [moment().startOf('quarter'), moment()],
'Year To Date': [moment().startOf('year'), moment()]
}
},
adecAfterIntervalChange
); //, 'All Time': [moment().startOf('year').subtract(19, 'years'), moment()]
var cookieValue = "Period Before";
if (getCookie("adecIIComp")=="Year Before")
cookieValue="Year Before";
//alert(getCookie("adecIIComp") + " -> " + cookieValue);
document.getElementById("adecComp").innerHTML=cookieValue;
window.adecIIComp=cookieValue;
cookieValue = getCookie("adecIIdisplaybar");
if (window.location.hostname.includes("nataliemariejewellery.com"))
{
cookieValue = "no"; //special request, also above
}
if (cookieValue != "") {
if (cookieValue=="yes") {
adecShow();
window.stopGettingData=false;
}
else
{
window.stopGettingData=true;
adecHide();
}
}
else
{
adecShow();
window.stopGettingData=false;
}
//Will trigger first update of boxes
adecAfterIntervalChange(start, end, range);
});
});
});
});
});
});
});
});
}
else
{
//not admin, nada
//console.log('inSites: NOT admin; do not display the bar');
}
//write cookie if needed
var adecNewBid=adecRetrieveVar('adecNewBid');
if (adecNewBid!="" && adecNewBid!=0)
{
if (!isNumber(adecNewBid))
{
//alert("adecNewBid is not number: " + adecNewBid);
}
else
{
//if (getCookie("adecIIBId")!="" && getCookie("adecIIBId")!=adecNewBid)
{
//alert("ERROR: setting new BId " + adecNewBid + " although we already had BId " + getCookie("adecIIBId"));
}
var d = new Date();
d.setTime(d.getTime() + 31536000000); //one year
var expires = "expires="+ d.toUTCString();
if (canTrack || !window.Shopify.customerPrivacy || window.Shopify.customerPrivacy.analyticsProcessingAllowed()) {
document.cookie = "adecIIBId=" + adecNewBid + "; " + expires + "; path=/; SameSite=None; Secure";
//console.log("Cookie set");
}
else
{
//console.log("User did not consent to tracking, will not set cookie");
}
//console.log('inSites: bId to cookie: ' + adecNewBid);
}
}
var adecNewSid=adecRetrieveVar('adecSid');
if (adecNewSid!="" && adecNewSid!=0)
{
if (!isNumber(adecNewSid))
{
//alert("adecNewSid is not number: " + adecNewSid);
}
else
{
//if (getCookie("adecIISId")!="" && getCookie("adecIISId")!=adecNewSid)
{
//alert("ERROR: setting new SId " + adecNewSid + " although we already had SId " + getCookie("adecIISId"));
}
//if (canTrack || !window.Shopify.customerPrivacy || window.Shopify.customerPrivacy.analyticsProcessingAllowed())
{
//var d = new Date();
//d.setTime(d.getTime() + 1800000); //30 mins
//var expires = "expires="+ d.toUTCString(); //" + expires + ";
//Session cookie, expires when browser closes
document.cookie = "adecIISId=" + adecNewSid + "; path=/; SameSite=None; Secure";
//alert('wrote newBid in cookie: ' + adecNewSid);
}
}
}
}
//Find out data about the current page in client's browser
window.adecID='';
window.adecType='';
if (typeof __st !== "undefined") {
if (typeof __st.p !="undefined")
{ window.adecType =__st.p; }
if (typeof __st.rid !="undefined")
{ window.adecID = __st.rid; }
}
//has adecIIBId cookie?
var bid = getCookie("adecIIBId");
if (bid=="")
{
//alert("N-am cookie! Am doar: "+document.cookie);
}
function isNumber(n) { return !isNaN(parseFloat(n)) && !isNaN(n - 0) }
if (bid=="" || !isNumber(bid))
{
bid=0;
}
//console.log("inSites: bid from cookie: "+bid);
var sid = getCookie("adecIISId");
if (sid=="")
{
//alert("N-am cookie de sesiune! Am doar: "+document.cookie);
}
//alert("sid from cookie: "+sid);
if (sid=="" || !isNumber(sid))
{
sid=0;
}
//Check whether the visitor is admin; if yes, display the bar; if not, record its page view
var oReq = new XMLHttpRequest();
oReq.addEventListener("load", displayTheBar);
var theUrl=encodeURIComponent(window.location.pathname+window.location.search);
var acceptCookies=areCookiesEnabled();
//console.log("/ii.php?bid=" + bid + "&sid=" + sid + "&t=" + window.adecType + "&i=" + window.adecID + "&u=" + theUrl + "&c=" + acceptCookies);
oReq.open("GET", "/apps/InSites/ii.php?iipath=apps/InSites&bid=" + bid + "&sid=" + sid + "&t=" + window.adecType + "&i=" + window.adecID + "&u=" + theUrl + "&c=" + acceptCookies );
oReq.send();
})();
}