How do I identify whether someone installed my app from the Chrome Web Store and then signed in with Google OpenID?
If someone installs my app in the Chrome Web Store, I authenticate them using their Google OpenID profile and sign them into the app automatically.
In order to handle problems (eg. if the user accidentally uninstalls the app from Chrome but still wants to use it by opening the URL manually) we offer a "sign in with Google" button on the app's sign in screen. As a result it's now possible t开发者_StackOverflow社区o sign in with Google even without installing via the Web Store, just by heading to the sign in screen.
However, I would like to send a specific welcome email to people who installed the app in the Web Store and then signed in using Google. How can I tell someone went through this process, as opposed to someone who just happened to sign in with Google?
The easiest thing that we suggest is to check for the presence of chrome.app.isInstalled
in your client page. This is only visible for apps that are installed.
if(chrome && chrome.app && chrome.app.isInstalled == true)
alert('installed');
On the server side of things, you have a couple of options:
- Set the web_url for the launch parameter to be a "app only" page.
- Check the http referrer header. On launch the header is "newtab" when it is launched as an app.
精彩评论