Create native app install/launch button
A new element like amp-app-install that takes app store URLs and other information that is needed to figure out whether an app in installed on a device.
The element adds CSS classes to itself based on device platform (iOS, Android, …) and based on whether the app is installed already. It has not UI itself, just allows CSS based content toggling.
If the element manages to determine that the app is installed and the user clicks it launches app, otherwise goes to appropriate app store. Should support deep linking as possible.
CC @adewale
A user-friendly app install banner component for AMP.
This must support the following parameters:
- ios-app-url: which points to the Apple-mandated URL for your app as documented here: https://developer.apple.com/app-store/marketing/guidelines/
- ios-content-url: which deeplinks to the page inside the iOS app
- android-app-url: which points to the Android-mandated URL for your app as documented here: http://developer.android.com/distribute/tools/promote/linking.html
- android-content-url: which deeplinks to the page inside the Android app
- web-content-url: which deeplinks to the canonical HTML page
- install-message: the localised text telling the user to install the app
- content-message: the localised text telling the user to open the content in the app
<amp-app-install ios-app-url=”https://itunes.apple.com/app/medium-everyones-stories/id828256236?mt=8” ios-content-url=”medium:/p/8878aae002f8” android-app-url=”http://play.google.com/store/apps/details?id=com.medium.reader” android-content-url=”android-app://com.medium.reader/https/medium.com/p/8878aae002f8” web-content-url=”https://medium.com/kickstarter/a-brief-history-of-oculus-from-day-zero-to-day-one-8878aae002f8”
install-message=”Install”
content-message=”Open in app”
/>
Here is a proposed UI for the above markup.
One possible approach to implementation is to detect the user’s platform (based on the user-agent) and expose the relevant combination of *app-url and *content-url. On desktop expose the web-content-url. Expose the the install-message and content-message on all platforms except desktop. Expose these values in a way that lets the publisher style the content block just like amp-user-notification.
Some additional bits...
Functionality:
- Needs to support trackable links to measure installs, retention, etc. For example: iOS: https://itunes.apple.com/us/app/apple-store/id384101264?pt=300983&ct=campaign-name&mt=8 Android: https://play.google.com/store/apps/details?id=com.dailymail.online&referrer=utm_source%3Dcampaign-name
- Banner should have the option to remain sticky at the top of the screen and follow the user as you scroll down an article
- Because of point 2, user should be able to dismiss the banner (X button)
- Ideally, if user dismisses the banner, it should not reappear for 30 days
Design:
- Ability to display star rating from the App stores
- Ability to add a small app icon
Also, as per #954, this should be named 'amp-install-app'.
Regarding the name, <amp-install-serviceworker> actually does install a service worker; this doesn't install the app.
Is "installing" or linking to a PWA in scope here? If so, I think the UX deserves some consideration, because there's quite a few different things the user and the publisher might expect or want to happen, and it's not clear how to at least indicate to the user what's going to happen, even if it's not possible to give the user complete control.
Possible destinations of the "I want an enhanced experience" button (and there might be more than one choice, as in @adewale's mockups, though probably not all four):
- Canonical web page (and it's not a PWA)
- Canonical web page (and it's a PWA)
- App install page (on Play Store, App Store, etc.), followed by deep link into app
- Deep link into app (but only if already installed)
I think it's likely that different users will have different preferences, and that these might different from publisher preferences. For example a user might want the button to do (2), falling back to (4) and then (1)--but never (3)--but a publisher might want (4), (3), (2), (1). (2) and (4) may also be mostly indistinguishable from each other.
You are right. amp-app-banner is a clearer name.
There are currently no hooks for triggering installation of a PWA via an app-banner and the general consensus seems to be that the heuristic-based triggering of A2H is a 'good thing.' However #981 is a better solution for the PWA use case since it offers many of the same benefits, avoids the complexity of balancing user+publisher requirements and is more congruent with the idea that a PWA enhances a normal web app rather than being a completely different kind of experience.
A2HS currently does not trigger on any AMP page, either on or off cache (due to #2975), so that won't help users "upgrade" to a PWA. And I think there should be some way to help users get there aside from publishers manually linking to it from their AMP pages (even if <amp-app-banner> isn't it).
@mkhatib some feedback based on discussion with @noahrs and other publishers.
Let's make it possible for banners to be shown inline like these: https://goo.gl/photos/HobYuSoDhUZc9rEH7
Note that these aren't modal. They act like inline ads inside the article. The main reason for providing this feature is that currently the user lands on a page and is asked to make a decision about installing an app or reading the article in an installed app when they have the least information about the article. Publishers have pointed out that they'd like to be able to defer that decision so that a user could be asked to decide at an arbitrary point during the article or at the end of the article. That way the user is being asked to make a decision at a point when they have far more information about the article and the publication.
/cc @dpup
Just for the record, we've decided to go ahead and focus on implementing the fixed dismissible app banner with one button that would open in the app if already installed otherwise would take the user to proper app store.
We'll be working on a different extension for the inline links. Will share a ITI once we get started on that.
For now closing this - as the main PR is now in. Will open separate issues for different bugs.