New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

analytics-utils

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

analytics-utils - npm Package Compare versions

Comparing version 0.0.21 to 0.0.22

33

dist/analytics-utils.js

@@ -73,2 +73,34 @@ var analyticsUtils = (function (exports) {

function hasAdblock() {
if (!inBrowser) return false; // Create fake ad
var fakeAd = document.createElement('div');
fakeAd.innerHTML = ' ';
fakeAd.className = 'pub_300x250 pub_300x250m pub_728x90 text-ad textAd text_ad text_ads text-ads text-ad-links';
fakeAd.style = 'width: 1px !important; height: 1px !important; position: absolute !important; left: -10000px !important; top: -1000px !important;';
try {
// insert into page
document.body.appendChild(fakeAd);
if (document.body.getAttribute('abp') !== null || fakeAd.offsetHeight === 0 || fakeAd.clientHeight === 0) {
return true;
}
if (typeof getComputedStyle !== 'undefined') {
var css = window.getComputedStyle(fakeAd, null);
if (css && (css.getPropertyValue('display') === 'none' || css.getPropertyValue('visibility') === 'hidden')) {
return true;
}
} // remove from page
document.body.removeChild(fakeAd);
} catch (e) {// swallow errors
}
return false;
}
function getBrowserLocale() {

@@ -724,2 +756,3 @@ if (!inBrowser) return null;

exports.decodeUri = decode;
exports.detectAdBlock = hasAdblock;
exports.getBrowserLocale = getBrowserLocale;

@@ -726,0 +759,0 @@ exports.getTimeZone = getTimeZone;

2

dist/analytics-utils.min.js

@@ -1,1 +0,1 @@

var analyticsUtils=function(e){"use strict";var u="undefined"!=typeof window;var a=function(){try{if(!u)return!1;var e="cookietest=";document.cookie="".concat(e,"1");var t=-1!==document.cookie.indexOf(e);return document.cookie="".concat(e,"1; expires=Thu, 01-Jan-1970 00:00:01 GMT"),t}catch(e){return!1}}();function l(e,t,n){if(!a)return!1;var r="";if(n){var o=new Date;o.setTime(o.getTime()+24*n*60*60*1e3),r="; expires=".concat(o.toGMTString())}document.cookie="".concat(e,"=").concat(t).concat(r,"; path=/")}function f(e){if(!a)return!1;for(var t="".concat(e,"="),n=document.cookie.split(";"),r=0;r<n.length;r++){for(var o=n[r];" "===o.charAt(0);)o=o.substring(1,o.length);if(0===o.indexOf(t))return o.substring(t.length,o.length)}return null}function r(e){if(!a)return!1;l(e,"",-1)}var t={getCookie:f,setCookie:l,removeCookie:r};function s(e){return decodeURIComponent(e).replace(/\+/g," ")}function m(e){if(!u)return!1;var t=e||document.referrer;if(t){var n=window.document.location.port,r=t.split("/")[2];return n&&(r=r.replace(":".concat(n),"")),r!==window.location.hostname}return!1}function c(e,t){var n=(e.split("?")||[,])[1];if(!n||-1===n.indexOf(t))return e;var r=new RegExp("(\\&|\\?)".concat(t,'([_A-Za-z0-9"+=.%]+)'),"g"),o="?".concat(n).replace(r,"").replace(/^&/,"?");return e.replace("?".concat(n),o)}function i(e){var t=function(e){if(e){var t=e.match(/\?(.*)/);return t&&t[1]?t[1].split("#")[0]:""}return u&&window.location.search.substring(1)}(e);return t?function(e){var t,n=/([^&=]+)=?([^&]*)/g,r={};for(;t=n.exec(e);){var o=s(t[1]),a=s(t[2]);if("[]"===o.substring(o.length-2))o=o.substring(0,o.length-2),(r[o]||(r[o]=[])).push(a);else{var c=""===a||a;r[o]=c}}for(var i in r){var u=i.split("[");if(1<u.length){var l=[];u.forEach(function(e,t){var n=e.replace(/[?[\]\\ ]/g,"");l.push(n)}),g(r,l,r[i]),delete r[i]}}return r}(t):{}}function g(e,t,n){for(var r=t.length-1,o=0;o<r;++o){var a=t[o];a in e||(e[a]={}),e=e[a]}e[t[r]]=n}function n(e){if(!u)return null;var t=document.createElement("a");return t.setAttribute("href",e),t.hostname}function d(e){return(n(e)||"").split(".").slice(-2).join(".")}function v(e){var t=e.split(".");return 1<t.length?t.slice(0,-1).join("."):e}var o={trimTld:v,getDomainBase:d,getDomainHost:n},p="google";var h={"daum.net":"q","eniro.se":"search_word","naver.com":"query","yahoo.com":"p","msn.com":"q","aol.com":"q","lycos.com":"q","ask.com":"q","cnn.com":"query","about.com":"terms","baidu.com":"wd","yandex.com":"text","seznam.cz":"q","search.com":"q","yam.com":"k","kvasir.no":"q","terra.com":"query","mynet.com":"q","rambler.ru":"words",google:"q","bing.com":{p:"q",n:"live"}};function y(e){return(y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function w(t){var n;try{void 0===(n=JSON.parse(t))&&(n=t),"true"===n&&(n=!0),"false"===n&&(n=!1),parseFloat(n)===n&&"object"!==y(n)&&(n=parseFloat(n))}catch(e){n=t}return n}var b="undefined"!=typeof self&&self?self:"undefined"!=typeof window&&window?window:"undefined"!=typeof global&&global?global:"undefined"!=typeof globalThis&&globalThis?globalThis:void 0;var S=function(){if(!u)return!1;try{if("undefined"==typeof localStorage||"undefined"==typeof JSON)return!1;localStorage.setItem("_test_","1"),localStorage.removeItem("_test_")}catch(e){return!1}return!0}();function k(e){return"string"==typeof e?e:e.storage}function x(e){return S&&(!e||"localStorage"===e)}function O(e){return a&&(!e||"cookie"===e)}var q={getItem:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(!e)return null;var n=k(t);if(x(n)){var r=localStorage.getItem(e);if(r||"localStorage"===n)return w(r)}if(O(n)){var o=f(e);if(o||"cookie"===n)return w(o)}return b[e]||null},setItem:function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(!e||!t)return!1;var r=k(n),o=JSON.stringify(t);if(x(r)){var a=w(localStorage.getItem(e));return localStorage.setItem(e,o),{value:t,oldValue:a,type:"localStorage"}}if(O(r)){var c=w(f(e));return l(e,o),{value:t,oldValue:c,type:"cookie"}}var i=b[e];return{value:b[e]=t,oldValue:i,type:"window"}},removeItem:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(!e)return!1;var n=k(t);return x(n)?(localStorage.removeItem(e),null):O(n)?(r(e),null):b[e]=null}};function I(){return 4294967295*Math.random()|0}return e.cookie=t,e.decodeUri=s,e.getBrowserLocale=function(){if(!u)return null;var e=navigator,t=e.language,n=e.languages,r=e.userLanguage;return n&&n.length?n[0]:r||t},e.getTimeZone=function(){return"undefined"==typeof Intl||"function"!=typeof Intl.DateTimeFormat||"function"!=typeof Intl.DateTimeFormat().resolvedOptions?null:Intl.DateTimeFormat().resolvedOptions().timeZone},e.inBrowser=u,e.isExternalReferrer=m,e.isScriptLoaded=function(n){if(!u)return!0;var r=document.getElementsByTagName("script");return!!Object.keys(r).filter(function(e){var t=r[e].src;return"string"==typeof n?-1!==t.indexOf(n):n instanceof RegExp&&t.match(n)}).length},e.noOp=function(){},e.paramsClean=c,e.paramsGet=function(e,t){return s((RegExp("".concat(e,"=(.+?)(&|$)")).exec(t)||[,""])[1])},e.paramsParse=i,e.paramsRemove=function(o,a){return u?new Promise(function(e,t){if(window.history&&window.history.replaceState){var n=window.location.href,r=c(n,o);n!==r&&history.replaceState({},"",r)}return a&&a(),e()}):Promise.resolve()},e.parseReferrer=function(e,t){if(!u)return!1;var n={source:"(direct)",medium:"(none)",campaign:"(not set)"};e&&m(e)&&(n.referrer=e);var r=function(e){if(!e||!u)return!1;var t=d(e),n=document.createElement("a");if(n.href=e,-1<n.hostname.indexOf(p)&&(t=p),h[t]){var r=h[t],o="string"==typeof r?r:r.p,a=new RegExp(o+"=.*?([^&#]*|$)","gi"),c=n.search.match(a);return{source:r.n||v(t),medium:"organic",term:(c?c[0].split("=")[1]:"")||"(not provided)"}}var i=m(e)?"referral":"internal";return{source:n.hostname,medium:i}}(e);r&&Object.keys(r).length&&(n=Object.assign({},n,r));var o=i(t),a=Object.keys(o);if(a.length){var c=a.reduce(function(e,t){return t.match(/^utm_/)&&(e["".concat(t.replace(/^utm_/,""))]=o[t]),t.match(/^(d|g)clid/)&&(e.source=p,e.medium=o.gclid?"cpc":"cpm",e[t]=o[t]),e},{});n=Object.assign({},n,c),(o.dclid||o.gclid)&&(n.source=p,n.medium=o.gclid?"cpc":"cpm")}return n},e.storage=q,e.url=o,e.uuid=function(){for(var e,t,n,r,o=[],a=0;a<256;a++)o[a]=(a<16?"0":"")+a.toString(16);return e=I(),t=I(),n=I(),r=I(),"".concat(o[255&e]+o[e>>8&255]+o[e>>16&255]+o[e>>24&255],"-").concat(o[255&t]).concat(o[t>>8&255],"-").concat(o[t>>16&15|64]).concat(o[t>>24&255],"-").concat(o[63&n|128]).concat(o[n>>8&255],"-").concat(o[n>>16&255]).concat(o[n>>24&255]).concat(o[255&r]).concat(o[r>>8&255]).concat(o[r>>16&255]).concat(o[r>>24&255])},e.globalContext=b,e}({});
var analyticsUtils=function(e){"use strict";var u="undefined"!=typeof window;var a=function(){try{if(!u)return!1;var e="cookietest=";document.cookie="".concat(e,"1");var t=-1!==document.cookie.indexOf(e);return document.cookie="".concat(e,"1; expires=Thu, 01-Jan-1970 00:00:01 GMT"),t}catch(e){return!1}}();function l(e,t,n){if(!a)return!1;var r="";if(n){var o=new Date;o.setTime(o.getTime()+24*n*60*60*1e3),r="; expires=".concat(o.toGMTString())}document.cookie="".concat(e,"=").concat(t).concat(r,"; path=/")}function f(e){if(!a)return!1;for(var t="".concat(e,"="),n=document.cookie.split(";"),r=0;r<n.length;r++){for(var o=n[r];" "===o.charAt(0);)o=o.substring(1,o.length);if(0===o.indexOf(t))return o.substring(t.length,o.length)}return null}function r(e){if(!a)return!1;l(e,"",-1)}var t={getCookie:f,setCookie:l,removeCookie:r};function s(e){return decodeURIComponent(e).replace(/\+/g," ")}function m(e){if(!u)return!1;var t=e||document.referrer;if(t){var n=window.document.location.port,r=t.split("/")[2];return n&&(r=r.replace(":".concat(n),"")),r!==window.location.hostname}return!1}function i(e,t){var n=(e.split("?")||[,])[1];if(!n||-1===n.indexOf(t))return e;var r=new RegExp("(\\&|\\?)".concat(t,'([_A-Za-z0-9"+=.%]+)'),"g"),o="?".concat(n).replace(r,"").replace(/^&/,"?");return e.replace("?".concat(n),o)}function c(e){var t=function(e){if(e){var t=e.match(/\?(.*)/);return t&&t[1]?t[1].split("#")[0]:""}return u&&window.location.search.substring(1)}(e);return t?function(e){var t,n=/([^&=]+)=?([^&]*)/g,r={};for(;t=n.exec(e);){var o=s(t[1]),a=s(t[2]);if("[]"===o.substring(o.length-2))o=o.substring(0,o.length-2),(r[o]||(r[o]=[])).push(a);else{var i=""===a||a;r[o]=i}}for(var c in r){var u=c.split("[");if(1<u.length){var l=[];u.forEach(function(e,t){var n=e.replace(/[?[\]\\ ]/g,"");l.push(n)}),d(r,l,r[c]),delete r[c]}}return r}(t):{}}function d(e,t,n){for(var r=t.length-1,o=0;o<r;++o){var a=t[o];a in e||(e[a]={}),e=e[a]}e[t[r]]=n}function n(e){if(!u)return null;var t=document.createElement("a");return t.setAttribute("href",e),t.hostname}function p(e){return(n(e)||"").split(".").slice(-2).join(".")}function g(e){var t=e.split(".");return 1<t.length?t.slice(0,-1).join("."):e}var o={trimTld:g,getDomainBase:p,getDomainHost:n},v="google";var y={"daum.net":"q","eniro.se":"search_word","naver.com":"query","yahoo.com":"p","msn.com":"q","aol.com":"q","lycos.com":"q","ask.com":"q","cnn.com":"query","about.com":"terms","baidu.com":"wd","yandex.com":"text","seznam.cz":"q","search.com":"q","yam.com":"k","kvasir.no":"q","terra.com":"query","mynet.com":"q","rambler.ru":"words",google:"q","bing.com":{p:"q",n:"live"}};function h(e){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function b(t){var n;try{void 0===(n=JSON.parse(t))&&(n=t),"true"===n&&(n=!0),"false"===n&&(n=!1),parseFloat(n)===n&&"object"!==h(n)&&(n=parseFloat(n))}catch(e){n=t}return n}var w="undefined"!=typeof self&&self?self:"undefined"!=typeof window&&window?window:"undefined"!=typeof global&&global?global:"undefined"!=typeof globalThis&&globalThis?globalThis:void 0;var x=function(){if(!u)return!1;try{if("undefined"==typeof localStorage||"undefined"==typeof JSON)return!1;localStorage.setItem("_test_","1"),localStorage.removeItem("_test_")}catch(e){return!1}return!0}();function S(e){return"string"==typeof e?e:e.storage}function k(e){return x&&(!e||"localStorage"===e)}function O(e){return a&&(!e||"cookie"===e)}var T={getItem:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(!e)return null;var n=S(t);if(k(n)){var r=localStorage.getItem(e);if(r||"localStorage"===n)return b(r)}if(O(n)){var o=f(e);if(o||"cookie"===n)return b(o)}return w[e]||null},setItem:function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};if(!e||!t)return!1;var r=S(n),o=JSON.stringify(t);if(k(r)){var a=b(localStorage.getItem(e));return localStorage.setItem(e,o),{value:t,oldValue:a,type:"localStorage"}}if(O(r)){var i=b(f(e));return l(e,o),{value:t,oldValue:i,type:"cookie"}}var c=w[e];return{value:w[e]=t,oldValue:c,type:"window"}},removeItem:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(!e)return!1;var n=S(t);return k(n)?(localStorage.removeItem(e),null):O(n)?(r(e),null):w[e]=null}};function q(){return 4294967295*Math.random()|0}return e.cookie=t,e.decodeUri=s,e.detectAdBlock=function(){if(!u)return!1;var e=document.createElement("div");e.innerHTML="&nbsp;",e.className="pub_300x250 pub_300x250m pub_728x90 text-ad textAd text_ad text_ads text-ads text-ad-links",e.style="width: 1px !important; height: 1px !important; position: absolute !important; left: -10000px !important; top: -1000px !important;";try{if(document.body.appendChild(e),null!==document.body.getAttribute("abp")||0===e.offsetHeight||0===e.clientHeight)return!0;if("undefined"!=typeof getComputedStyle){var t=window.getComputedStyle(e,null);if(t&&("none"===t.getPropertyValue("display")||"hidden"===t.getPropertyValue("visibility")))return!0}document.body.removeChild(e)}catch(e){}return!1},e.getBrowserLocale=function(){if(!u)return null;var e=navigator,t=e.language,n=e.languages,r=e.userLanguage;return n&&n.length?n[0]:r||t},e.getTimeZone=function(){return"undefined"==typeof Intl||"function"!=typeof Intl.DateTimeFormat||"function"!=typeof Intl.DateTimeFormat().resolvedOptions?null:Intl.DateTimeFormat().resolvedOptions().timeZone},e.inBrowser=u,e.isExternalReferrer=m,e.isScriptLoaded=function(n){if(!u)return!0;var r=document.getElementsByTagName("script");return!!Object.keys(r).filter(function(e){var t=r[e].src;return"string"==typeof n?-1!==t.indexOf(n):n instanceof RegExp&&t.match(n)}).length},e.noOp=function(){},e.paramsClean=i,e.paramsGet=function(e,t){return s((RegExp("".concat(e,"=(.+?)(&|$)")).exec(t)||[,""])[1])},e.paramsParse=c,e.paramsRemove=function(o,a){return u?new Promise(function(e,t){if(window.history&&window.history.replaceState){var n=window.location.href,r=i(n,o);n!==r&&history.replaceState({},"",r)}return a&&a(),e()}):Promise.resolve()},e.parseReferrer=function(e,t){if(!u)return!1;var n={source:"(direct)",medium:"(none)",campaign:"(not set)"};e&&m(e)&&(n.referrer=e);var r=function(e){if(!e||!u)return!1;var t=p(e),n=document.createElement("a");if(n.href=e,-1<n.hostname.indexOf(v)&&(t=v),y[t]){var r=y[t],o="string"==typeof r?r:r.p,a=new RegExp(o+"=.*?([^&#]*|$)","gi"),i=n.search.match(a);return{source:r.n||g(t),medium:"organic",term:(i?i[0].split("=")[1]:"")||"(not provided)"}}var c=m(e)?"referral":"internal";return{source:n.hostname,medium:c}}(e);r&&Object.keys(r).length&&(n=Object.assign({},n,r));var o=c(t),a=Object.keys(o);if(a.length){var i=a.reduce(function(e,t){return t.match(/^utm_/)&&(e["".concat(t.replace(/^utm_/,""))]=o[t]),t.match(/^(d|g)clid/)&&(e.source=v,e.medium=o.gclid?"cpc":"cpm",e[t]=o[t]),e},{});n=Object.assign({},n,i),(o.dclid||o.gclid)&&(n.source=v,n.medium=o.gclid?"cpc":"cpm")}return n},e.storage=T,e.url=o,e.uuid=function(){for(var e,t,n,r,o=[],a=0;a<256;a++)o[a]=(a<16?"0":"")+a.toString(16);return e=q(),t=q(),n=q(),r=q(),"".concat(o[255&e]+o[e>>8&255]+o[e>>16&255]+o[e>>24&255],"-").concat(o[255&t]).concat(o[t>>8&255],"-").concat(o[t>>16&15|64]).concat(o[t>>24&255],"-").concat(o[63&n|128]).concat(o[n>>8&255],"-").concat(o[n>>16&255]).concat(o[n>>24&255]).concat(o[255&r]).concat(o[r>>8&255]).concat(o[r>>16&255]).concat(o[r>>24&255])},e.globalContext=w,e}({});

@@ -74,2 +74,34 @@ 'use strict';

function hasAdblock() {
if (!inBrowser) return false; // Create fake ad
var fakeAd = document.createElement('div');
fakeAd.innerHTML = '&nbsp;';
fakeAd.className = 'pub_300x250 pub_300x250m pub_728x90 text-ad textAd text_ad text_ads text-ads text-ad-links';
fakeAd.style = 'width: 1px !important; height: 1px !important; position: absolute !important; left: -10000px !important; top: -1000px !important;';
try {
// insert into page
document.body.appendChild(fakeAd);
if (document.body.getAttribute('abp') !== null || fakeAd.offsetHeight === 0 || fakeAd.clientHeight === 0) {
return true;
}
if (typeof getComputedStyle !== 'undefined') {
var css = window.getComputedStyle(fakeAd, null);
if (css && (css.getPropertyValue('display') === 'none' || css.getPropertyValue('visibility') === 'hidden')) {
return true;
}
} // remove from page
document.body.removeChild(fakeAd);
} catch (e) {// swallow errors
}
return false;
}
function getBrowserLocale() {

@@ -725,2 +757,3 @@ if (!inBrowser) return null;

exports.decodeUri = decode;
exports.detectAdBlock = hasAdblock;
exports.getBrowserLocale = getBrowserLocale;

@@ -727,0 +760,0 @@ exports.getTimeZone = getTimeZone;

@@ -70,2 +70,34 @@ var inBrowser = typeof window !== 'undefined';

function hasAdblock() {
if (!inBrowser) return false; // Create fake ad
var fakeAd = document.createElement('div');
fakeAd.innerHTML = '&nbsp;';
fakeAd.className = 'pub_300x250 pub_300x250m pub_728x90 text-ad textAd text_ad text_ads text-ads text-ad-links';
fakeAd.style = 'width: 1px !important; height: 1px !important; position: absolute !important; left: -10000px !important; top: -1000px !important;';
try {
// insert into page
document.body.appendChild(fakeAd);
if (document.body.getAttribute('abp') !== null || fakeAd.offsetHeight === 0 || fakeAd.clientHeight === 0) {
return true;
}
if (typeof getComputedStyle !== 'undefined') {
var css = window.getComputedStyle(fakeAd, null);
if (css && (css.getPropertyValue('display') === 'none' || css.getPropertyValue('visibility') === 'hidden')) {
return true;
}
} // remove from page
document.body.removeChild(fakeAd);
} catch (e) {// swallow errors
}
return false;
}
function getBrowserLocale() {

@@ -719,2 +751,2 @@ if (!inBrowser) return null;

export { cookie, decode as decodeUri, getBrowserLocale, getTimeZone, inBrowser, isExternalReferrer, isScriptLoaded, noOp, paramsClean, getValueParamValue as paramsGet, paramsParse, paramsRemove, parseReferrer, index as storage, url, uuid, globalContext };
export { cookie, decode as decodeUri, hasAdblock as detectAdBlock, getBrowserLocale, getTimeZone, inBrowser, isExternalReferrer, isScriptLoaded, noOp, paramsClean, getValueParamValue as paramsGet, paramsParse, paramsRemove, parseReferrer, index as storage, url, uuid, globalContext };

@@ -74,2 +74,34 @@ 'use strict';

function hasAdblock() {
if (!inBrowser) return false; // Create fake ad
var fakeAd = document.createElement('div');
fakeAd.innerHTML = '&nbsp;';
fakeAd.className = 'pub_300x250 pub_300x250m pub_728x90 text-ad textAd text_ad text_ads text-ads text-ad-links';
fakeAd.style = 'width: 1px !important; height: 1px !important; position: absolute !important; left: -10000px !important; top: -1000px !important;';
try {
// insert into page
document.body.appendChild(fakeAd);
if (document.body.getAttribute('abp') !== null || fakeAd.offsetHeight === 0 || fakeAd.clientHeight === 0) {
return true;
}
if (typeof getComputedStyle !== 'undefined') {
var css = window.getComputedStyle(fakeAd, null);
if (css && (css.getPropertyValue('display') === 'none' || css.getPropertyValue('visibility') === 'hidden')) {
return true;
}
} // remove from page
document.body.removeChild(fakeAd);
} catch (e) {// swallow errors
}
return false;
}
function getBrowserLocale() {

@@ -725,2 +757,3 @@ if (!inBrowser) return null;

exports.decodeUri = decode;
exports.detectAdBlock = hasAdblock;
exports.getBrowserLocale = getBrowserLocale;

@@ -727,0 +760,0 @@ exports.getTimeZone = getTimeZone;

@@ -70,2 +70,34 @@ var inBrowser = typeof window !== 'undefined';

function hasAdblock() {
if (!inBrowser) return false; // Create fake ad
var fakeAd = document.createElement('div');
fakeAd.innerHTML = '&nbsp;';
fakeAd.className = 'pub_300x250 pub_300x250m pub_728x90 text-ad textAd text_ad text_ads text-ads text-ad-links';
fakeAd.style = 'width: 1px !important; height: 1px !important; position: absolute !important; left: -10000px !important; top: -1000px !important;';
try {
// insert into page
document.body.appendChild(fakeAd);
if (document.body.getAttribute('abp') !== null || fakeAd.offsetHeight === 0 || fakeAd.clientHeight === 0) {
return true;
}
if (typeof getComputedStyle !== 'undefined') {
var css = window.getComputedStyle(fakeAd, null);
if (css && (css.getPropertyValue('display') === 'none' || css.getPropertyValue('visibility') === 'hidden')) {
return true;
}
} // remove from page
document.body.removeChild(fakeAd);
} catch (e) {// swallow errors
}
return false;
}
function getBrowserLocale() {

@@ -719,2 +751,2 @@ if (!inBrowser) return null;

export { cookie, decode as decodeUri, getBrowserLocale, getTimeZone, inBrowser, isExternalReferrer, isScriptLoaded, noOp, paramsClean, getValueParamValue as paramsGet, paramsParse, paramsRemove, parseReferrer, index as storage, url, uuid, globalContext };
export { cookie, decode as decodeUri, hasAdblock as detectAdBlock, getBrowserLocale, getTimeZone, inBrowser, isExternalReferrer, isScriptLoaded, noOp, paramsClean, getValueParamValue as paramsGet, paramsParse, paramsRemove, parseReferrer, index as storage, url, uuid, globalContext };
{
"name": "analytics-utils",
"version": "0.0.21",
"version": "0.0.22",
"description": "Analytics utility functions",

@@ -57,3 +57,3 @@ "author": "David Wells <hello@davidwells.io>",

},
"gitHead": "3cef762ae3b0eec6c51c5124a4da5db43d855ce9"
"gitHead": "706ced454c0d0cf37ed899f4b30d13243622dfe7"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc