🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

workbox-google-analytics

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

workbox-google-analytics

Queues failed requests and uses the Background Sync API to replay them when the network is available

7.3.0
latest
Version published
Weekly downloads
3.7M
-22.99%
Maintainers
6
Weekly downloads
 
Created

What is workbox-google-analytics?

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.

What are workbox-google-analytics's main functionalities?

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'
  }
});

Other packages similar to workbox-google-analytics

FAQs

Package last updated on 29 Oct 2024

Did you know?

Socket

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.

Install

Related posts