workbox-google-analytics
Advanced tools
Comparing version 3.0.0-beta.1 to 3.0.0-beta.2
@@ -6,3 +6,3 @@ this.workbox = this.workbox || {}; | ||
try { | ||
self.workbox.v['workbox:google-analytics:3.0.0-beta.1'] = 1; | ||
self.workbox.v['workbox:google-analytics:3.0.0-beta.2'] = 1; | ||
} catch (e) {} // eslint-disable-line | ||
@@ -113,3 +113,3 @@ | ||
// qt param may be present and should be updated rather than replaced. | ||
const originalHitTime = timestamp - (params.get('qt') || 0); | ||
const originalHitTime = timestamp - (Number(params.get('qt')) || 0); | ||
const queueTime = Date.now() - originalHitTime; | ||
@@ -116,0 +116,0 @@ |
@@ -1,3 +0,3 @@ | ||
this.workbox=this.workbox||{},this.workbox.googleAnalytics=function(e,n,t,o,r,c,s){"use strict";try{self.workbox.v["workbox:google-analytics:3.0.0-beta.1"]=1}catch(e){}const l="www.google-analytics.com",i=/^\/(\w+\/)?collect/,a=(()=>{var e=babelHelpers.asyncToGenerator(function*(e){return yield new Promise(function(n,t){const o=new FileReader;o.onloadend=function(){return n(o.result)},o.onerror=function(){return t(o.error)},o.readAsText(e)})});return function(n){return e.apply(this,arguments)}})(),u=e=>(()=>{var n=babelHelpers.asyncToGenerator(function*(n){let{url:t,requestInit:o,timestamp:r}=n;t=new URL(t);let c;if(o.body){const e=o.body instanceof Blob?yield a(o.body):o.body;c=new URLSearchParams(e)}else c=t.searchParams;const s=r-(c.get("qt")||0),l=Date.now()-s;if(c.set("qt",l),e.parameterOverrides)for(const n of Object.keys(e.parameterOverrides)){const t=e.parameterOverrides[n];c.set(n,t)}"function"==typeof e.hitFilter&&e.hitFilter.call(null,c),o.body=c.toString(),o.method="POST",o.mode="cors",o.credentials="omit",o.headers={"Content-Type":"text/plain"},n.url=`${t.origin}${t.pathname}`});return function(e){return n.apply(this,arguments)}})();return e.initialize=((e={})=>{const a=t.cacheNames.getGoogleAnalyticsName(e.cacheName),w=new n.Plugin("workbox-google-analytics",{maxRetentionTime:2880,callbacks:{requestWillReplay:u(e)}}),f=[(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>e.hostname===l&&"/analytics.js"===e.pathname,n,"GET")})(a),(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>"www.googletagmanager.com"===e.hostname&&"/gtag/js"===e.pathname,n,"GET")})(a),...(e=>{const n=({url:e})=>e.hostname===l&&i.test(e.pathname),t=new s.NetworkOnly({plugins:[e]});return[new o.Route(n,t,"GET"),new o.Route(n,t,"POST")]})(w)],b=new r.Router;for(const e of f)b.registerRoute(e);self.addEventListener("fetch",e=>{const n=b.handleRequest(e);n&&e.respondWith(n)})}),e}({},workbox.backgroundSync,workbox.core._private,workbox.routing,workbox.routing,workbox.strategies,workbox.strategies); | ||
this.workbox=this.workbox||{},this.workbox.googleAnalytics=function(e,n,t,o,r,c,s){"use strict";try{self.workbox.v["workbox:google-analytics:3.0.0-beta.2"]=1}catch(e){}const l="www.google-analytics.com",i=/^\/(\w+\/)?collect/,a=(()=>{var e=babelHelpers.asyncToGenerator(function*(e){return yield new Promise(function(n,t){const o=new FileReader;o.onloadend=function(){return n(o.result)},o.onerror=function(){return t(o.error)},o.readAsText(e)})});return function(n){return e.apply(this,arguments)}})(),u=e=>(()=>{var n=babelHelpers.asyncToGenerator(function*(n){let{url:t,requestInit:o,timestamp:r}=n;t=new URL(t);let c;if(o.body){const e=o.body instanceof Blob?yield a(o.body):o.body;c=new URLSearchParams(e)}else c=t.searchParams;const s=r-(Number(c.get("qt"))||0),l=Date.now()-s;if(c.set("qt",l),e.parameterOverrides)for(const n of Object.keys(e.parameterOverrides)){const t=e.parameterOverrides[n];c.set(n,t)}"function"==typeof e.hitFilter&&e.hitFilter.call(null,c),o.body=c.toString(),o.method="POST",o.mode="cors",o.credentials="omit",o.headers={"Content-Type":"text/plain"},n.url=`${t.origin}${t.pathname}`});return function(e){return n.apply(this,arguments)}})();return e.initialize=((e={})=>{const a=t.cacheNames.getGoogleAnalyticsName(e.cacheName),w=new n.Plugin("workbox-google-analytics",{maxRetentionTime:2880,callbacks:{requestWillReplay:u(e)}}),f=[(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>e.hostname===l&&"/analytics.js"===e.pathname,n,"GET")})(a),(e=>{const n=new c.NetworkFirst({cacheName:e});return new o.Route(({url:e})=>"www.googletagmanager.com"===e.hostname&&"/gtag/js"===e.pathname,n,"GET")})(a),...(e=>{const n=({url:e})=>e.hostname===l&&i.test(e.pathname),t=new s.NetworkOnly({plugins:[e]});return[new o.Route(n,t,"GET"),new o.Route(n,t,"POST")]})(w)],b=new r.Router;for(const e of f)b.registerRoute(e);self.addEventListener("fetch",e=>{const n=b.handleRequest(e);n&&e.respondWith(n)})}),e}({},workbox.backgroundSync,workbox.core._private,workbox.routing,workbox.routing,workbox.strategies,workbox.strategies); | ||
//# sourceMappingURL=workbox-google-analytics.prod.js.map |
{ | ||
"name": "workbox-google-analytics", | ||
"version": "3.0.0-beta.1", | ||
"version": "3.0.0-beta.2", | ||
"license": "Apache-2.0", | ||
@@ -31,7 +31,7 @@ "author": "Google's Web DevRel Team", | ||
"dependencies": { | ||
"workbox-background-sync": "^3.0.0-beta.1", | ||
"workbox-core": "^3.0.0-beta.1", | ||
"workbox-routing": "^3.0.0-beta.1", | ||
"workbox-strategies": "^3.0.0-beta.1" | ||
"workbox-background-sync": "^3.0.0-beta.2", | ||
"workbox-core": "^3.0.0-beta.2", | ||
"workbox-routing": "^3.0.0-beta.2", | ||
"workbox-strategies": "^3.0.0-beta.2" | ||
} | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33147