Security News
vlt Debuts New JavaScript Package Manager and Serverless Registry at NodeConf EU
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
workbox-google-analytics
Advanced tools
A service worker helper library to retry offline Google Analytics requests when a connection is available.
The workbox-google-analytics package is a module within the Workbox suite that helps you integrate Google Analytics into your service worker. It allows you to automatically track offline Google Analytics events and send them when the user comes back online.
Offline Google Analytics
This feature allows you to automatically track Google Analytics events even when the user is offline. The events are stored and sent to Google Analytics when the user comes back online.
import { initialize } from 'workbox-google-analytics';
initialize();
Custom Cache Name
You can specify a custom cache name for storing Google Analytics events. This is useful if you want to manage the cache more granularly.
import { initialize } from 'workbox-google-analytics';
initialize({
cacheName: 'custom-google-analytics-cache'
});
Parameter Customization
This feature allows you to customize the parameters sent with each Google Analytics hit. For example, you can add a custom dimension to indicate that the hit was sent while offline.
import { initialize } from 'workbox-google-analytics';
initialize({
parameterOverrides: {
cd1: 'offline'
}
});
The sw-offline-google-analytics package is another library that helps you integrate Google Analytics with service workers. It provides similar functionality to workbox-google-analytics, such as tracking offline events and sending them when the user is back online. However, it is not part of the Workbox suite and may require more manual setup.
The offline-plugin is a webpack plugin that provides offline support for web applications. It includes a feature for integrating with Google Analytics to track offline events. While it offers broader offline capabilities beyond just Google Analytics, it may be more complex to configure compared to workbox-google-analytics.
A service worker helper library to retry offline Google Analytics requests when a connection is available.
npm install --save-dev workbox-google-analytics
Read more at this module's documentation page.
View the sample code to see this module put to use.
This module is a part of Workbox, which is a collection of JavaScript libraries for Progressive Web Apps.
Visit https://workboxjs.org/ to learn more about what Workbox can do for you.
FAQs
Queues failed requests and uses the Background Sync API to replay them when the network is available
The npm package workbox-google-analytics receives a total of 3,029,116 weekly downloads. As such, workbox-google-analytics popularity was classified as popular.
We found that workbox-google-analytics demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Security News
Research
The Socket Research Team uncovered a malicious Python package typosquatting the popular 'fabric' SSH library, silently exfiltrating AWS credentials from unsuspecting developers.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.