Is it running as an installed app right now?
function displayMode() {
if (navigator.standalone) return 'standalone-ios';
for (const m of ['fullscreen', 'standalone', 'minimal-ui', 'window-controls-overlay']) {
if (matchMedia(`(display-mode: ${m})`).matches) return m;
}
return 'browser';
}
Send displayMode() with every page view as a custom dimension. In CSS, use @media (display-mode: standalone).
Was it launched from the icon?
Give your manifest a tagged start URL:
"start_url": "/?source=pwa"
Launches from the icon (and from shortcuts, if you tag them too) carry the parameter. Count them in analytics, then remove the parameter with history.replaceState so it is not shared.
Did they install it?
- Chromium: listen for
appinstalled, and recorduserChoice.outcomefrombeforeinstallprompt(custom install button). - iOS: there is no event. The first launch in standalone mode is your best signal: store a flag in
localStorageand send an "installed launch" event once.
Is it installed, from a normal tab?
navigator.getInstalledRelatedApps() (Chromium) can tell a page whether the user has installed a related app: your Android app, or your PWA itself if you list it in related_applications with "platform": "webapp" and the manifest URL.
const apps = await navigator.getInstalledRelatedApps?.() ?? [];
if (apps.length) hideInstallPromo();
Support is limited (mainly Chrome on Android and Windows), so treat it as a bonus.
Respect privacy
Display mode and install events are not personal data in themselves, but they go through your analytics, so they follow your consent rules. PWA.live only sends them to Google Analytics in production, after cookie consent. More in PWA analytics.
Browser support
| Feature | Chrome / Edge desktop | Chrome Android | Safari iOS / iPadOS | Safari macOS | Firefox desktop | Firefox Android | Samsung Internet |
|---|---|---|---|---|---|---|---|
| beforeinstallprompt (own install button) | Chrome / Edge desktop: Yes | Chrome Android: Yes | Safari iOS / iPadOS: No | Safari macOS: No | Firefox desktop: No | Firefox Android: No | Samsung Internet: Yes |
| getInstalledRelatedApps() | Chrome / Edge desktop: Partial (Mainly Windows) | Chrome Android: Yes | Safari iOS / iPadOS: No | Safari macOS: No | Firefox desktop: No | Firefox Android: No | Samsung Internet: Varies |