Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable PWA prompt #6407

Closed
sachben91 opened this issue Jan 19, 2024 · 14 comments · Fixed by #6640
Closed

Enable PWA prompt #6407

sachben91 opened this issue Jan 19, 2024 · 14 comments · Fixed by #6640
Assignees
Labels

Comments

@sachben91
Copy link

sachben91 commented Jan 19, 2024

Description

Users should be prompted to download the progressive web app or add the app to their home screen (depending on Android or iOS) when they visit Common on mobile. Regardless of the page that they are on, as soon as the device has been detected as Android or iOs, the requisite prompt should be displayed to the user.

The business goal of the PWA is to increase retention by utilizing push notifications on mobile for engagement. More on this is detailed in this PRD: Progressive Web App PRD

Related tickets
#6226

Project Owners

PM: @sachben91
Design: Jared

Designs

Figma

Feature specs

  • The only page exempted from the prompt is the marketing home page. All other pages should show the PWA prompt when the user in on a mobile device
  • The user should be shown the appropriate prompt every time they are open Common within their browser on mobile.
  • When the user navigates to any page on Common within iOS, they should be shown the following prompt. When the user clicks on share > add to the home screen, the PWA should appear on the home screen of the user

Image

  • When the user navigates to any page on Common within Android, they should be shown the following prompt. When the user clicks on install, it should add the PWA to the user's home screen

Image

  • The user should have the ability to check "show less often" which will reduce the frequency of the pwa prompt to the user
  • If a user clicks "show less often" , they should not be shown the pwa prompt for 7 days

Image

@rbennettcw
Copy link
Contributor

Estimating as 3.

Unsure if we can reliably detect if a PWA is installed across both Safari (iOS) and Chrome (Android).

We might be able to detect if the user is currently running in “standalone” mode, as a PWA.

@rbennettcw rbennettcw added 3 Full day task and removed needs estimate labels Feb 1, 2024
@CowMuon
Copy link
Contributor

CowMuon commented Feb 2, 2024

We might be able to detect if the user is currently running in “standalone” mode, as a PWA.

Seems tricky on Android. Once installed, how do you actually tell if it's a PWA or installed from the Play Store?

@dillchen
Copy link
Contributor

dillchen commented Feb 2, 2024

@rbennettcw you are definitely able to reliably find the device

  useEffect(() => {
    if (window.matchMedia('(display-mode: standalone)').matches || window.navigator.standalone === true) {
      setIsStandalone(true);
    }
  }, []);

This use effect hook is sufficient and works here -> https://baka.rocks/

@CowMuon
Copy link
Contributor

CowMuon commented Feb 2, 2024

@dillchen Confirmed to work on Android, or only iOS?

@dillchen
Copy link
Contributor

dillchen commented Feb 2, 2024

Need a splash page for mobile (if is mobile create splash page and prompt user to login)

@rbennettcw
Copy link
Contributor

Confirmed that we can detect if the user is currently looking at the site via PWA on both platforms:

Before (not in PWA):
CleanShot 2024-02-01 at 23 26 28@2x

After (inside PWA):
CleanShot 2024-02-01 at 23 28 20@2x


However, I was referring to the requirement RE: If they user has already downloaded the pwa/added it to the home screen, they should be prompted to open the PWA if they open the site on the browser within mobile

I'm not sure we can detect from the standard browser if the user has added the PWA to the home screen, because browsers typically restrict access to knowing which apps are installed on the device.

@dillchen
Copy link
Contributor

dillchen commented Feb 2, 2024 via email

@rbennettcw
Copy link
Contributor

The purpose of getInstalledRelatedApps() is to get the related native apps that are installed (specified via manifest file)– but it doesn’t detect the presence of the PWA itself added to the Home Screen.

A lot of these PWA-specific features are experimental and not supported on Safari:


Ultimately, iOS will not tell us if the PWA is installed from outside of the PWA.

IMO, due to the aforementioned constraint + friction of manually installing, we should expect low conversion rates and thus be persistent but not forceful with the CTA– otherwise risk losing some non-PWA users due to annoyance.

Proposed resolution:

  • If mobile user is not in PWA, show CTA with "remind me later" button
    • Show CTA at a frequency– every N hours/days with capped exponential backoff

Also, I see that push notifications are a goal. That's a whole 'nother can of worms and not scoped in any tickets AFAICS. Are push notifications expected to be implemented by ETH Denver?

@rbennettcw
Copy link
Contributor

Another constraint to bear in mind: there's storage isolation between iOS Safari and the installed PWA, so if the user logs in via Safari then installs the PWA, they'll need to log in again in PWA: https://web.dev/learn/pwa/detection#ios_and_ipados_storage_isolation

@dillchen
Copy link
Contributor

dillchen commented Feb 3, 2024 via email

@sachben91
Copy link
Author

@rbennettcw Thanks for looking into this.

"If mobile user is not in PWA, show CTA with the "remind me later" button
Show CTA at a frequency– every N hours/days with capped exponential backoff" - this solution works for me, will talk with Jared tomorrow and get back to you with new design

@sachben91
Copy link
Author

added the "show less often" option based on @rbennettcw suggestion for PWA - this should be unblocked now

@mw2000
Copy link
Contributor

mw2000 commented Feb 15, 2024

@dillchen @sachben91 from your conversation above I understand that it's okay if we're not able to detect automatically if PWA is installed on the device or not as long as we have the show less often button and the user is actually able to install the pwa.

@mw2000 mw2000 linked a pull request Feb 15, 2024 that will close this issue
@sachben91
Copy link
Author

@mw2000 thats accurate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants