My site is a progressive web app (single page / SPA) that works offline.

I'd like to use Google Analytics but aren't sure how to report events in this case, especially since the device may be offline.

Is there a good way to do this?