Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const initialize = (options: GoogleAnalyticsInitializeOptions = {}) => {
const cacheName = cacheNames.getGoogleAnalyticsName(options.cacheName);
const bgSyncPlugin = new BackgroundSyncPlugin(QUEUE_NAME, {
maxRetentionTime: MAX_RETENTION_TIME,
onSync: createOnSyncCallback(options),
});
const routes = [
createGtmJsRoute(cacheName),
createAnalyticsJsRoute(cacheName),
createGtagJsRoute(cacheName),
...createCollectRoutes(bgSyncPlugin),
];
const router = new Router();
for (const route of routes) {
router.registerRoute(route);