php - 如何检测用户在移动设备上并提供应用程序

标签 php android ios mobile

我在 MotoGP.com 上看到,当我从移动设备或平板电脑上查看该网站时,我收到一条消息说“你想看我们的移动应用程序吗”,如果我下次选择“否”我从同一台设备访问该消息不再出现。我真的很想在我的网站上引入这样的功能,但我不确定这样做的好方法,我想是这样的:

  • 在用户访问网站时使用 PHP 查找工具(尝试检测操作系统、iOS 或安卓系统)
  • 查找用户的MAC地址
  • 从数据库中包含 MAC 地址和 bool 标志的表中,检查 如果用户以前访问过并表示不希望看到 再次出现对话框。
  • 如果 MAC 地址不在数据库中,则显示消息
  • 如果 MAC 地址在设置了标志的数据库中,则不显示消息。

关于这是否是一个好方法的任何评论?这正是我从头开始想出的,搜索似乎一无所获。

感谢任何评论。

大卫

最佳答案

免责声明:这不是在回答记住用户选择的问题,而是帮助您更好地通知用户(比侵入式弹出窗口更好)。如果您设法将它与@WDUK 的回答的第二点结合起来(我认为这比这个更适合作为“公认的答案”),您可能会得到一些非常好的东西。


看看Smart Banners .

它并不能完全解决您的问题,但可以解决一部分问题。

如果用户没有在他的设备上安装该应用程序,横幅将出现,并带有指向您在 AppStore 上的应用程序的链接。如果安装了该应用,单击横幅将打开您的应用(如果用户来自智能横幅,您可以让您的应用执行一些特殊操作)。

如果用户拒绝安装应用程序,它并不能解决让横幅“记住”的问题,但它们确实“聪明”并且有一些优势。

来自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.

关于php - 如何检测用户在移动设备上并提供应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14520036/

相关文章:

javascript - 使用 setinterval 函数重新加载 javascript 变量

ios - 在 UITextView 中更改变量

安卓工作室 : Layout Preview gives "native typeface cannot be made"

android - 裁剪 Canvas 后如何从 ImageView 中删除承受空间?

android - 面对 kotlin Dagger 2 的问题

ios - 将带有图像的 NSAttributedString 保存到 RTF 文件时遇到问题

ios - Swift - 如何防止在强制退出时关闭套接字?

php - 将数据从 PHP 脚本发送到 iOS

php - MySql 调查不同查询

php - curl 错误 : OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 54