Reputation: 499
I've seen on MotoGP.com that when I view the site from a mobile device or tablet I get a message saying 'would you like to see our mobile apps' message and if I choose 'no' that the next time I visit from the same device the message no longer appears. I would really like to introduce such functionality to my site but I'm unsure about a good way to do that, I thought something like this:
Any comments on whether this is a good approach or not? It's just what I came up with from scratch and searching seemed to yield nothing.
Thanks for any comments.
David
Upvotes: 0
Views: 7151
Reputation: 19030
The easy way to do this is as follows:
Detect their device via their User Agent. See How do I check if the useragent is an ipad or iphone? on how to do so (Deceptive question name, this method would work for any device/browser). Also available is a convenience class in PHP.
Set a cookie if the user declines, so that you can check in future as to whether you should show your prompt again. See What is the "best" way to get and set a single cookie value using JavaScript on how to do so in Javascript.
An amalgamation of this and rdurand's idea would create the best solution for you for all mobile devices. Smart Banners are available to devices running iOS6 and above, and provide a neat and tidy way to inform your users that there is a mobile app available for their platform. If the device runs iOS 5 or below, or isn't iOS at all, then the above method I've described should cover their bases too.
Upvotes: 1
Reputation: 523
I think there is a mobile detect class you can use. This might be useful - http://code.google.com/p/php-mobile-detect/
Upvotes: 0
Reputation: 7410
Disclaimer : this is not answering the problem of remembering the user's choice, but this will help you in your process of informing your user nicely (better than an intrusive pop-up). If you manage to combine it with the second point of @WDUK 's answer (which I think is more appropriate to be an "accepted answer" than this one), you'll probably get something pretty good.
Have a look at Smart Banners.
It does not entirely solve your problem, but some of it.
If the user doesn't have the app installed on his device, the banner will appear with alink to your app on the AppStore. If the app is installed, clicking on the banner will open your app (you can have your app do something special if the user comes from the Smart Banner).
It does not solve your issue of having the banner "remember" if the user refused to install the app, but they really are "smart" and have some advantages.
Coming from Apple's documentation :
Users will trust that tapping the banner will take them to the App Store and not a third-party advertisement. They will appreciate that banners are presented unobtrusively at the top of a webpage, instead of as a full-screen ad interrupting the web content. And with a large and prominent close button, a banner is easy for users to dismiss.
If the app is already installed on a user's device, the banner intelligently changes its action, and tapping the banner will simply open the app. If the user doesn’t have your app on his device, tapping on the banner will take him to the app’s entry in the App Store. When he returns to your website, a progress bar appears in the banner, indicating how much longer the download will take to complete. When the app finishes downloading, the View button changes to an Open button, and tapping the banner will open the app while preserving the user’s context from your website.
Smart App Banners automatically determine whether the app is supported on the user’s device. If the device loading the banner does not support your app, or if your app is not available in the user's location, the banner will not display.
Upvotes: 2