How to trace the opening of the PWA?

Is PWA and I need to figure out when a user opens (with screen)
How to do it?
April 19th 20 at 12:06
1 answer
April 19th 20 at 12:08
I wanted to reply to that when you install on home screen events occur

but it turned out that now there's a simple media query for this, see
(I haven't tried, don't know how it works)

if (window.matchMedia('(display-mode: standalone)').matches) { 
 // do things here 
 // set a variable to be used when calling something 
 // e.g. call Google Analytics to track use standalone 
not that I need to understand when each time the user opens the pwa - Kristopher_Stroman commented on April 19th 20 at 12:11
@Kristopher_Stroman, and just switches between tabs or apply?

document.addEventListener("visibilitychange", function() {
 if (document.visibilityState === 'visible') {
 // here you can refresh data from DB

^ the listener to put in the main component of the APPA - will.Zula commented on April 19th 20 at 12:14
@will.Zula, La thank you beautiful III - Kristopher_Stroman commented on April 19th 20 at 12:17

Find more questions by tags JavaScript