Measure PWA installs

That post is almost 2 years old. We didn’t have the JavaScript column back then.

Yes.
In fact, simply copy/pasting that code that you linked to seems to do the trick:

function getPWADisplayMode() {
  const isStandalone = window.matchMedia('(display-mode: standalone)').matches;
  if (document.referrer.startsWith('android-app://')) {
    return 'twa';
  } else if (navigator.standalone || isStandalone) {
    return 'standalone';
  }
  return 'browser';
}

return getPWADisplayMode();

Using the output of the above and displaying it in a hint component, I get:

  1. In the builder (Chrome on MacOS):

  1. When installed on the home screen on my phone (Safari on IOS):

4 Likes