Esta página aún no está disponible en Español, así que estás leyendo la versión en inglés.

Detect if your PWA is installed, and count installs

Running in a tab or as an app? Here is how to know.

Instalación Intermedio 1 min de lectura Revisada el 27 nov 2026

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 record userChoice.outcome from beforeinstallprompt (custom install button).
  • iOS: there is no event. The first launch in standalone mode is your best signal: store a flag in localStorage and 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.

Compatibilidad de navegadores

Compatibilidad de los navegadores con funciones de PWA
FunciónChrome / Edge desktopChrome AndroidSafari iOS / iPadOSSafari macOSFirefox desktopFirefox AndroidSamsung Internet
beforeinstallprompt (own install button) Chrome / Edge desktop: Sí Chrome Android: Sí Safari iOS / iPadOS: No Safari macOS: No Firefox desktop: No Firefox Android: No Samsung Internet: Sí

Ver la tabla completa