plausible-tracker
Advanced tools
Comparing version 0.3.7 to 0.3.8
@@ -12,3 +12,2 @@ "use strict"; | ||
function sendEvent(eventName, data, options) { | ||
var _a; | ||
const isLocalhost = /^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*:)*?:?0*1$/.test(location.hostname) || location.protocol === 'file:'; | ||
@@ -18,8 +17,10 @@ if (!data.trackLocalhost && isLocalhost) { | ||
} | ||
const canAccessLocalStorage = typeof ((_a = window.localStorage) === null || _a === void 0 ? void 0 : _a.getItem) === 'function'; | ||
const shouldIgnoreCurrentBrowser = canAccessLocalStorage && | ||
localStorage.getItem('plausible_ignore') === 'true'; | ||
if (shouldIgnoreCurrentBrowser) { | ||
return console.warn('[Plausible] Ignoring event because "plausible_ignore" is set to "true" in localStorage'); | ||
try { | ||
if (window.localStorage.plausible_ignore === 'true') { | ||
return console.warn('[Plausible] Ignoring event because "plausible_ignore" is set to "true" in localStorage'); | ||
} | ||
} | ||
catch (e) { | ||
null; | ||
} | ||
const payload = { | ||
@@ -48,2 +49,2 @@ n: eventName, | ||
exports.sendEvent = sendEvent; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVxdWVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9saWIvcmVxdWVzdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUEyQkE7Ozs7OztHQU1HO0FBQ0gsU0FBZ0IsU0FBUyxDQUN2QixTQUFpQixFQUNqQixJQUFnQyxFQUNoQyxPQUFzQjs7SUFFdEIsTUFBTSxXQUFXLEdBQ2YsNkRBQTZELENBQUMsSUFBSSxDQUNoRSxRQUFRLENBQUMsUUFBUSxDQUNsQixJQUFJLFFBQVEsQ0FBQyxRQUFRLEtBQUssT0FBTyxDQUFDO0lBRXJDLElBQUksQ0FBQyxJQUFJLENBQUMsY0FBYyxJQUFJLFdBQVcsRUFBR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UFBVSxLQUFLLENBQUM7WUFBRSxPQUFPO1FBQ2pDLElBQUksT0FBTyxJQUFJLE9BQU8sQ0FBQyxRQUFRLEVBQUU7WUFDL0IsT0FBTyxDQUFDLFFBQVEsRUFBRSxDQUFDO1NBQ3BCO0lBQ0gsQ0FBQyxDQUFDO0FBQ0osQ0FBQztBQS9DRCw4QkErQ0MifQ== |
@@ -13,8 +13,10 @@ /** | ||
} | ||
const canAccessLocalStorage = typeof window.localStorage?.getItem === 'function'; | ||
const shouldIgnoreCurrentBrowser = canAccessLocalStorage && | ||
localStorage.getItem('plausible_ignore') === 'true'; | ||
if (shouldIgnoreCurrentBrowser) { | ||
return console.warn('[Plausible] Ignoring event because "plausible_ignore" is set to "true" in localStorage'); | ||
try { | ||
if (window.localStorage.plausible_ignore === 'true') { | ||
return console.warn('[Plausible] Ignoring event because "plausible_ignore" is set to "true" in localStorage'); | ||
} | ||
} | ||
catch (e) { | ||
null; | ||
} | ||
const payload = { | ||
@@ -42,2 +44,2 @@ n: eventName, | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVxdWVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9saWIvcmVxdWVzdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUEyQkE7Ozs7OztHQU1HO0FBQ0gsTUFBTSxVQUFVLFNBQVMsQ0FDdkIsU0FBaUIsRUFDakIsSUFBZ0MsRUFDaEMsT0FBc0I7SUFFdEIsTUFBTSxXQUFXLEdBQ2YsNkRBQTZELENBQUMsSUFBSSxDQUNoRSxRQUFRLENBQUMsUUFBUSxDQUNsQixJQUFJLFFBQVEsQ0FBQyxRQUFRLEtBQUssT0FBTyxDQUFDO0lBRXJDLElBQUksQ0FBQyxJQUFJLENBQUMsY0FBYyxJQUFJLFdBQVcsRUFBRTtRQUN2QyxPQUFPLE9BQU8sQ0FBQyxJQUFJ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QyxJQUFJLE9BQU8sSUFBSSxPQUFPLENBQUMsUUFBUSxFQUFFO1lBQy9CLE9BQU8sQ0FBQyxRQUFRLEVBQUUsQ0FBQztTQUNwQjtJQUNILENBQUMsQ0FBQztBQUNKLENBQUMifQ== |
@@ -5,2 +5,8 @@ # Changelog | ||
### [0.3.8](https://github.com/Maronato/plausible-tracker/compare/v0.3.7...v0.3.8) (2022-06-07) | ||
### Bug Fixes | ||
* **tracker:** Use try/catch for localstorage check | ||
### [0.3.7](https://github.com/Maronato/plausible-tracker/compare/v0.3.5...v0.3.7) (2022-06-06) | ||
@@ -7,0 +13,0 @@ |
{ | ||
"name": "plausible-tracker", | ||
"version": "0.3.7", | ||
"version": "0.3.8", | ||
"description": "Official frontend tracker to interact with Plausible Analytics", | ||
@@ -5,0 +5,0 @@ "main": "build/main/index.js", |
@@ -51,13 +51,10 @@ import type { PlausibleOptions } from './tracker'; | ||
const canAccessLocalStorage = | ||
typeof window.localStorage?.getItem === 'function'; | ||
const shouldIgnoreCurrentBrowser = | ||
canAccessLocalStorage && | ||
localStorage.getItem('plausible_ignore') === 'true'; | ||
if (shouldIgnoreCurrentBrowser) { | ||
return console.warn( | ||
'[Plausible] Ignoring event because "plausible_ignore" is set to "true" in localStorage' | ||
); | ||
try { | ||
if (window.localStorage.plausible_ignore === 'true') { | ||
return console.warn( | ||
'[Plausible] Ignoring event because "plausible_ignore" is set to "true" in localStorage' | ||
); | ||
} | ||
} catch (e) { | ||
null; | ||
} | ||
@@ -64,0 +61,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
2113
0
152554