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

@internetarchive/analytics-manager

Package Overview
Dependencies
Maintainers
14
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@internetarchive/analytics-manager - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

16

dist/src/analytics-manager.js

@@ -32,8 +32,14 @@ export class AnalyticsManager {

const url = this.generateTrackingUrl(values).toString();
if (!this.requireImagePing &&
typeof window.navigator !== 'undefined' &&
typeof window.navigator.sendBeacon !== 'undefined') {
window.navigator.sendBeacon(url);
if (this.requireImagePing) {
this.sendPingViaImage(url);
return;
}
else {
// `navigator` has to be bound to ensure it does not error in some browsers
// https://xgwang.me/posts/you-may-not-know-beacon/#it-may-throw-error%2C-be-sure-to-catch
const send = navigator.sendBeacon && navigator.sendBeacon.bind(navigator);
try {
// if `send` is `undefined` it'll throw and fall back to the image ping
send(url);
}
catch (err) {
this.sendPingViaImage(url);

@@ -40,0 +46,0 @@ }

{
"name": "@internetarchive/analytics-manager",
"version": "0.1.1",
"version": "0.1.2",
"description": "A manager for Internet Archive analytics.",

@@ -5,0 +5,0 @@ "author": "Internet Archive",

@@ -123,11 +123,17 @@ export type AnalyticsEventConfig = {

const url = this.generateTrackingUrl(values).toString();
if (
!this.requireImagePing &&
typeof window.navigator !== 'undefined' &&
typeof window.navigator.sendBeacon !== 'undefined'
) {
window.navigator.sendBeacon(url);
} else {
if (this.requireImagePing) {
this.sendPingViaImage(url);
return;
}
// `navigator` has to be bound to ensure it does not error in some browsers
// https://xgwang.me/posts/you-may-not-know-beacon/#it-may-throw-error%2C-be-sure-to-catch
const send = navigator.sendBeacon && navigator.sendBeacon.bind(navigator);
try {
// if `send` is `undefined` it'll throw and fall back to the image ping
send!(url);
} catch (err) {
this.sendPingViaImage(url);
}
}

@@ -134,0 +140,0 @@

Sorry, the diff of this file is not supported yet

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