@tsteur opened this Pull Request on May 22nd 2020 Member

refs https://github.com/matomo-org/matomo/issues/9939

early stage... usage:

within a service worker do

self.importScripts('https://your.matomo.domain/offline-service-worker.js');
matomoAnalytics.initialize();

to register service worker:

if ('serviceWorker' in navigator) {
  window.addEventListener('load', function() {
    navigator.serviceWorker.register('/your-service-worker.js');
  });
}

We discussed to merge this early in the beta even though it might not fully work yet. This way people can test it easily and give us feedback and review etc.

@tsteur commented on October 1st 2020 Member

and also it caches piwik.js/matomo.js? is this needed or can it just be cached via an http header?

It can't really be cached via http header in case you are fully offline etc. Otherwise the approach is correct 👍

@tsteur commented on October 1st 2020 Member

@diosmosis applies few changes. Would otherwise love to get this merged to see if it really works and what problems there are in general. Eg I'm not an indexeddb / service worker so I'm sure there might be few things that maybe won't work as expected or could cause race conditions or so maybe.

This Pull Request was closed on October 2nd 2020
Powered by GitHub Issue Mirror