(function (){

const findGetParameter = (parameterName) => {
  let result = null,
      tmp = [];
  const items = location.search.substr(1).split("&");
  for (let index = 0; index < items.length; index++) {
    tmp = items[index].split("=");
    if (tmp[0] === parameterName) result = decodeURIComponent(tmp[1]);
  }
  return result;
};

let codePath = 'counterCode.js';

if(findGetParameter("pgdev") != null){
  codePath = 'counterCodeDev.js';
}

// if(window.location.href === 'https://www.primegate.io/'){
//   codePath = 'counterCodeDev.js';
// }

const protocolCode =
    "https:" == document.location.protocol ? "https://" : "http://";
const counterScriptBlockCode = document.createElement("script");
counterScriptBlockCode.charset = "utf-8";
counterScriptBlockCode.src =
    protocolCode + "js.primegate.io/" + codePath + "?" + new Date().getTime();

document.documentElement
    .getElementsByTagName("head")[0]
    .appendChild(counterScriptBlockCode);
})();
