Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

workbox-google-analytics

Package Overview
Dependencies
Maintainers
4
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

workbox-google-analytics - npm Package Compare versions

Comparing version 5.0.0-alpha.2 to 5.0.0-beta.0

2

_version.js
// @ts-ignore
try {
self['workbox:google-analytics:5.0.0-alpha.2'] && _();
self['workbox:google-analytics:5.0.0-beta.0'] && _();
}
catch (e) { }
this.workbox = this.workbox || {};
this.workbox.googleAnalytics = (function (exports, Plugin_js, cacheNames_js, getFriendlyURL_js, logger_js, Route_js, Router_js, NetworkFirst_js, NetworkOnly_js) {
this.workbox.googleAnalytics = (function (exports, BackgroundSyncPlugin_js, cacheNames_js, getFriendlyURL_js, logger_js, Route_js, Router_js, NetworkFirst_js, NetworkOnly_js) {
'use strict';

@@ -7,3 +7,3 @@

try {
self['workbox:google-analytics:5.0.0-alpha.2'] && _();
self['workbox:google-analytics:5.0.0-beta.0'] && _();
} catch (e) {}

@@ -41,3 +41,3 @@

* Creates the requestWillDequeue callback to be used with the background
* sync queue plugin. The callback takes the failed request and adds the
* sync plugin. The callback takes the failed request and adds the
* `qt` param based on the current time, as well as applies any other

@@ -122,3 +122,3 @@ * user-defined hit modifications.

*
* @param {Plugin} queuePlugin
* @param {BackgroundSyncPlugin} bgSyncPlugin
* @return {Array<Route>} The created routes.

@@ -130,3 +130,3 @@ *

const createCollectRoutes = queuePlugin => {
const createCollectRoutes = bgSyncPlugin => {
const match = ({

@@ -137,3 +137,3 @@ url

const handler = new NetworkOnly_js.NetworkOnly({
plugins: [queuePlugin]
plugins: [bgSyncPlugin]
});

@@ -222,7 +222,7 @@ return [new Route_js.Route(match, handler, 'GET'), new Route_js.Route(match, handler, 'POST')];

const cacheName = cacheNames_js.cacheNames.getGoogleAnalyticsName(options.cacheName);
const queuePlugin = new Plugin_js.Plugin(QUEUE_NAME, {
const bgSyncPlugin = new BackgroundSyncPlugin_js.BackgroundSyncPlugin(QUEUE_NAME, {
maxRetentionTime: MAX_RETENTION_TIME,
onSync: createOnSyncCallback(options)
});
const routes = [createGtmJsRoute(cacheName), createAnalyticsJsRoute(cacheName), createGtagJsRoute(cacheName), ...createCollectRoutes(queuePlugin)];
const routes = [createGtmJsRoute(cacheName), createAnalyticsJsRoute(cacheName), createGtagJsRoute(cacheName), ...createCollectRoutes(bgSyncPlugin)];
const router = new Router_js.Router();

@@ -229,0 +229,0 @@

@@ -1,2 +0,2 @@

this.workbox=this.workbox||{},this.workbox.googleAnalytics=function(t,e,o,n,a,c,w,r,s){"use strict";try{self["workbox:google-analytics:5.0.0-alpha.2"]&&_()}catch(t){}const i=/^\/(\w+\/)?collect/,l=t=>async({queue:e})=>{let o;for(;o=await e.shiftRequest();){const{request:n,timestamp:a}=o,c=new URL(n.url);try{const w="POST"===n.method?new URLSearchParams(await n.clone().text()):c.searchParams,r=a-(Number(w.get("qt"))||0),s=Date.now()-r;if(w.set("qt",String(s)),t.parameterOverrides)for(const e of Object.keys(t.parameterOverrides)){const o=t.parameterOverrides[e];w.set(e,o)}"function"==typeof t.hitFilter&&t.hitFilter.call(null,w),await fetch(new Request(c.origin+c.pathname,{body:w.toString(),method:"POST",mode:"cors",credentials:"omit",headers:{"Content-Type":"text/plain"}}))}catch(t){throw await e.unshiftRequest(o),t}}},g=t=>{const e=({url:t})=>"www.google-analytics.com"===t.hostname&&i.test(t.pathname),o=new s.NetworkOnly({plugins:[t]});return[new c.Route(e,o,"GET"),new c.Route(e,o,"POST")]},m=t=>{const e=new r.NetworkFirst({cacheName:t});return new c.Route(({url:t})=>"www.google-analytics.com"===t.hostname&&"/analytics.js"===t.pathname,e,"GET")},u=t=>{const e=new r.NetworkFirst({cacheName:t});return new c.Route(({url:t})=>"www.googletagmanager.com"===t.hostname&&"/gtag/js"===t.pathname,e,"GET")},h=t=>{const e=new r.NetworkFirst({cacheName:t});return new c.Route(({url:t})=>"www.googletagmanager.com"===t.hostname&&"/gtm.js"===t.pathname,e,"GET")};return t.initialize=((t={})=>{const n=o.cacheNames.getGoogleAnalyticsName(t.cacheName),a=new e.Plugin("workbox-google-analytics",{maxRetentionTime:2880,onSync:l(t)}),c=[h(n),m(n),u(n),...g(a)],r=new w.Router;for(const t of c)r.registerRoute(t);r.addFetchListener()}),t}({},workbox.backgroundSync,workbox.core._private,workbox.core._private,workbox.core._private,workbox.routing,workbox.routing,workbox.strategies,workbox.strategies);
this.workbox=this.workbox||{},this.workbox.googleAnalytics=function(t,e,o,n,a,c,w,r,s){"use strict";try{self["workbox:google-analytics:5.0.0-beta.0"]&&_()}catch(t){}const i=/^\/(\w+\/)?collect/,l=t=>async({queue:e})=>{let o;for(;o=await e.shiftRequest();){const{request:n,timestamp:a}=o,c=new URL(n.url);try{const w="POST"===n.method?new URLSearchParams(await n.clone().text()):c.searchParams,r=a-(Number(w.get("qt"))||0),s=Date.now()-r;if(w.set("qt",String(s)),t.parameterOverrides)for(const e of Object.keys(t.parameterOverrides)){const o=t.parameterOverrides[e];w.set(e,o)}"function"==typeof t.hitFilter&&t.hitFilter.call(null,w),await fetch(new Request(c.origin+c.pathname,{body:w.toString(),method:"POST",mode:"cors",credentials:"omit",headers:{"Content-Type":"text/plain"}}))}catch(t){throw await e.unshiftRequest(o),t}}},g=t=>{const e=({url:t})=>"www.google-analytics.com"===t.hostname&&i.test(t.pathname),o=new s.NetworkOnly({plugins:[t]});return[new c.Route(e,o,"GET"),new c.Route(e,o,"POST")]},m=t=>{const e=new r.NetworkFirst({cacheName:t});return new c.Route(({url:t})=>"www.google-analytics.com"===t.hostname&&"/analytics.js"===t.pathname,e,"GET")},u=t=>{const e=new r.NetworkFirst({cacheName:t});return new c.Route(({url:t})=>"www.googletagmanager.com"===t.hostname&&"/gtag/js"===t.pathname,e,"GET")},h=t=>{const e=new r.NetworkFirst({cacheName:t});return new c.Route(({url:t})=>"www.googletagmanager.com"===t.hostname&&"/gtm.js"===t.pathname,e,"GET")};return t.initialize=((t={})=>{const n=o.cacheNames.getGoogleAnalyticsName(t.cacheName),a=new e.BackgroundSyncPlugin("workbox-google-analytics",{maxRetentionTime:2880,onSync:l(t)}),c=[h(n),m(n),u(n),...g(a)],r=new w.Router;for(const t of c)r.registerRoute(t);r.addFetchListener()}),t}({},workbox.backgroundSync,workbox.core._private,workbox.core._private,workbox.core._private,workbox.routing,workbox.routing,workbox.strategies,workbox.strategies);
//# sourceMappingURL=workbox-offline-ga.prod.js.map

@@ -8,3 +8,3 @@ /*

*/
import { Plugin } from 'workbox-background-sync/Plugin.js';
import { BackgroundSyncPlugin } from 'workbox-background-sync/BackgroundSyncPlugin.js';
import { cacheNames } from 'workbox-core/_private/cacheNames.js';

@@ -21,3 +21,3 @@ import { getFriendlyURL } from 'workbox-core/_private/getFriendlyURL.js';

* Creates the requestWillDequeue callback to be used with the background
* sync queue plugin. The callback takes the failed request and adds the
* sync plugin. The callback takes the failed request and adds the
* `qt` param based on the current time, as well as applies any other

@@ -92,3 +92,3 @@ * user-defined hit modifications.

*
* @param {Plugin} queuePlugin
* @param {BackgroundSyncPlugin} bgSyncPlugin
* @return {Array<Route>} The created routes.

@@ -98,7 +98,7 @@ *

*/
const createCollectRoutes = (queuePlugin) => {
const createCollectRoutes = (bgSyncPlugin) => {
const match = ({ url }) => url.hostname === GOOGLE_ANALYTICS_HOST &&
COLLECT_PATHS_REGEX.test(url.pathname);
const handler = new NetworkOnly({
plugins: [queuePlugin],
plugins: [bgSyncPlugin],
});

@@ -170,3 +170,3 @@ return [

const cacheName = cacheNames.getGoogleAnalyticsName(options.cacheName);
const queuePlugin = new Plugin(QUEUE_NAME, {
const bgSyncPlugin = new BackgroundSyncPlugin(QUEUE_NAME, {
maxRetentionTime: MAX_RETENTION_TIME,

@@ -179,3 +179,3 @@ onSync: createOnSyncCallback(options),

createGtagJsRoute(cacheName),
...createCollectRoutes(queuePlugin),
...createCollectRoutes(bgSyncPlugin),
];

@@ -182,0 +182,0 @@ const router = new Router();

{
"name": "workbox-google-analytics",
"version": "5.0.0-alpha.2",
"version": "5.0.0-beta.0",
"license": "MIT",

@@ -33,8 +33,8 @@ "author": "Google's Web DevRel Team",

"dependencies": {
"workbox-background-sync": "^5.0.0-alpha.2",
"workbox-core": "^5.0.0-alpha.2",
"workbox-routing": "^5.0.0-alpha.2",
"workbox-strategies": "^5.0.0-alpha.2"
"workbox-background-sync": "^5.0.0-beta.0",
"workbox-core": "^5.0.0-beta.0",
"workbox-routing": "^5.0.0-beta.0",
"workbox-strategies": "^5.0.0-beta.0"
},
"gitHead": "0cb0029b692c3802545238fe59b6d6179ca32f6c"
"gitHead": "136b38f2c701bd7c04e808d19961310a9ede524b"
}
// @ts-ignore
try{self['workbox:google-analytics:5.0.0-alpha.2']&&_()}catch(e){}
try{self['workbox:google-analytics:5.0.0-beta.0']&&_()}catch(e){}

@@ -9,3 +9,3 @@ /*

import {Plugin} from 'workbox-background-sync/Plugin.js';
import {BackgroundSyncPlugin} from 'workbox-background-sync/BackgroundSyncPlugin.js';
import {Queue} from 'workbox-background-sync/Queue.js';

@@ -41,3 +41,3 @@ import {cacheNames} from 'workbox-core/_private/cacheNames.js';

* Creates the requestWillDequeue callback to be used with the background
* sync queue plugin. The callback takes the failed request and adds the
* sync plugin. The callback takes the failed request and adds the
* `qt` param based on the current time, as well as applies any other

@@ -121,3 +121,3 @@ * user-defined hit modifications.

*
* @param {Plugin} queuePlugin
* @param {BackgroundSyncPlugin} bgSyncPlugin
* @return {Array<Route>} The created routes.

@@ -127,3 +127,3 @@ *

*/
const createCollectRoutes = (queuePlugin: Plugin) => {
const createCollectRoutes = (bgSyncPlugin: BackgroundSyncPlugin) => {
const match = ({url}: RouteMatchCallbackOptions) =>

@@ -134,3 +134,3 @@ url.hostname === GOOGLE_ANALYTICS_HOST &&

const handler = new NetworkOnly({
plugins: [queuePlugin],
plugins: [bgSyncPlugin],
});

@@ -217,3 +217,3 @@

const queuePlugin = new Plugin(QUEUE_NAME, {
const bgSyncPlugin = new BackgroundSyncPlugin(QUEUE_NAME, {
maxRetentionTime: MAX_RETENTION_TIME,

@@ -227,3 +227,3 @@ onSync: createOnSyncCallback(options),

createGtagJsRoute(cacheName),
...createCollectRoutes(queuePlugin),
...createCollectRoutes(bgSyncPlugin),
];

@@ -230,0 +230,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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