用户体验改善案例_如何检测用户的设备,以便改善他们的用户体验
用户体验改善案例
A few months ago I watched a great talk from the Chrome Dev Summit about performance in slow devices.
几个月前,我观看了Chrome开发者峰会上有关慢速设备性能的精彩演讲。
It blew my mind all the work done by Facebook in identifying devices to create a better user experience. Fast-forward to now, and I've decided to study a bit more about the topic and see what I can do at Thinkific (the company I work for).
这让我震惊,Facebook在识别设备以创建更好的用户体验方面所做的所有工作。 快进到现在,我决定对这个主题进行更多研究,看看我在Thinkific (我工作的公司)可以做什么。
用户代理 (User agents)
User agents are well-known by developers. We use them to detect bots, redirect users to a specific version of our website or append CSS classes on our page so we can create different experiences.
用户代理是开发人员众所周知的。 我们使用它们来检测漫游器,将用户重定向到我们网站的特定版本或在页面上附加CSS类,以便我们可以创建不同的体验。
At Thinkific we already use the browser Ruby gem to parse the user-agent and get relevant info (bot detection for instance). So, I decided to persist the main info in a visitor_device table – here is the schema:
在Thinkific,我们已经使用浏览器Ruby gem来解析用户代理并获取相关信息(例如,机器人检测)。 因此,我决定将主要信息保留在visitor_device表中–这是模式:
tenant_id: the course creator school the visitor is checking raw: the raw ua type: desktop / mobile / tablet / bot / other browser_name browser_version platform_name platform_version hardware: hstore containing memory, processor, device_model, device_name connection: hstore containing downlink_max, connection_type |
tenant_id: the course creator school the visitor is checking raw: the raw ua type: desktop / mobile / tablet / bot / other browser_name browser_version platform_name platform_version hardware: hstore containing memory, processor, device_model, device_name connection: hstore containing downlink_max, connection_type |
You probably noticed that a few things there are not available in the UA string. Time for new JavaScript APIs:
您可能已经注意到UA字符串中没有一些可用的东西。 新JavaScript API的时间:
使用JavaScript获取硬件信息 (Getting hardware info using JavaScript)
As covered in the Chrome Dev Summit video, we can use JS to get this info.
如Chrome Dev Summit视频中所述,我们可以使用JS来获取此信息。
记忆 (Memory)
navigator.deviceMemory
will return a floating-point number. There are things to consider here:
navigator.deviceMemory
将返回一个浮点数。 这里有一些事情要考虑:
- It only works over HTTPS它只能在HTTPS上工作
- Support is quite limited (Chrome only basically)支持非常有限(基本上仅适用于Chrome)
More about it:
关于它的更多信息:
Spec from W3C
W3C的规格
MDN Docs
MDN文件
Can I use deviceMemory
我可以使用deviceMemory吗
处理器 (Processors)
navigator.hardwareConcurrency
will return the number of logical cores of the user’s CPU. Support for this is decent.
navigator.hardwareConcurrency
将返回用户CPU的逻辑核心数。 对此的支持是体面的 。
使用JavaScript检测连接信息 (Detecting connection info using JavaScript)
navigator.connection
is a new API containing information about the system’s connection, such as the current bandwidth of the user’s device or whether the connection is metered. The support is quite limited (Chrome only basically) but things are promising.
navigator.connection
是一个新的API,其中包含有关系统连接的信息,例如用户设备的当前带宽或是否对连接进行计量。 支持是非常有限的(基本上仅是Chrome),但是前景很好。
More about it:
关于它的更多信息:
Chrome example
Chrome实例
MDN Docs
MDN文件
Can I use Network Information API
我可以使用网络信息API
检测设备型号 (Detecting the device model)
The user agent may return some information about the model name. userstack is a service that gives you information based on the user agent. It works well and it is easy to integrate, however, depending on your needs, they can’t help.
用户代理可能会返回有关型号名称的一些信息。 userstack是一项服务,可根据用户代理为您提供信息。 它运作良好且易于集成,但是根据您的需求,他们无济于事。
Take for instance iDevices. Their user agent is basically the same so you can’t differentiate an iPad Pro from an old iPad that runs the last iOS. For these cases, you may need a better detection based on resolution, pixel density and other hardware information exposed in the browser. I did some quick research on this and found 3 products so far: WURFL.io, DeviceAtlas and 51Degrees. I haven’t had time to try their products yet, but I am looking forward to doing it (and posting about it)
以iDevices为例。 他们的用户代理基本相同,因此您无法将iPad Pro与运行最后一个iOS的旧iPad区分开。 对于这些情况,您可能需要根据浏览器中显示的分辨率,像素密度和其他硬件信息进行更好的检测。 我对此进行了一些快速研究,到目前为止找到3种产品: WURFL.io , DeviceAtlas和51Degrees 。 我还没有时间尝试他们的产品,但是我很期待这样做(并发布有关它的信息)
常问问题 (FAQ)
Question: Why not use Google Analytics / Mixpanel / Kibana / New Relic / your tool here?
问题:为什么不在这里使用Google Analytics(分析)/ Mixpanel / Kibana / New Relic /您的工具?
We could get browser info inside other tools. But as a SaaS product we don’t use our own Google Analytics property (customers add their own). Also, adblockers may block these third-party tools. Last but not least, by having this info in our side we can adapt better.
我们可以在其他工具中获取浏览器信息。 但是作为SaaS产品,我们不使用自己的Google Analytics(分析)媒体资源(客户添加自己的媒体资源)。 此外,adblocker可能会阻止这些第三方工具。 最后但并非最不重要的一点是,通过在我们这方面提供此信息,我们可以更好地进行调整。
Question: Do you have a list of low-end/high-end devices?
问题:您是否有低端/高端设备列表?
No. Maybe this can be built combining the number of processors and memory but I didn’t invest much time on this. In this project, my colleague created a Rails helper that would determine if the user would use the lite or default version of a website based on hardware. On this topic, it is important to mention that Facebook has a library for Android called Device Year Class.
不会。也许可以结合处理器和内存的数量来构建,但是我并没有为此花费很多时间。 在这个项目中,我的同事创建了一个Rails助手,该助手将确定用户是基于硬件还是使用Lite或默认版本的网站。 在这个主题上,重要的是要提到Facebook有一个Android的库,称为Device Year Class 。
Also posted on my blog. If you like this content, follow me on Twitter and GitHub.
也张贴在我的博客上 。 如果您喜欢此内容,请在Twitter和GitHub上关注我。
By the way - Thinkific is hiring for several positions if you are interested.
顺便说一句- Thinkific被聘请 为 几个位置 ,如果你有兴趣。
翻译自: https://www.freecodecamp.org/news/exploring-device-detection-for-better-user-experiences-in-2020/
用户体验改善案例
相关文章:

【如何快速的开发一个完整的iOS直播app】(采集篇)
前言在看这篇之前,如果您还不了解直播原理,请查看这篇文章如何快速的开发一个完整的iOS直播app(原理篇)开发一款直播app,首先需要采集主播的视频和音频,然后传入流媒体服务器,本篇主要讲解如何采集主播的视频和音频&am…

easyui 报表合并单元格
前段时间工作中碰到有需求,要求数据按下图所示格式来显示,当时在园子里看到了一篇文章(时间久了,想不起是哪一篇),研究了后做出了如下的DEMO,在此当作学习笔记,简单记录一下。 首先是…

HDU2594 KMP next数组的应用
这道题就是给你两个串s1, s2让你求出s1 s2的最长相同前缀和后缀, 我们直接将s1 s2连接到一起然后处理一下next数组即可, 注意答案应该是min(len(s1), len(s2) , next[len]), 代码如下: #include <cstdio> #include <cstring> #in…

c语言中浮点数和整数转换_C中的数据类型-整数,浮点数和空隙说明
c语言中浮点数和整数转换C中的数据类型 (Data Types in C) There are several different ways to store data in C, and they are all unique from each other. The types of data that information can be stored as are called data types. C is much less forgiving about d…

【如何快速的开发一个完整的iOS直播app】(美颜篇)
前言在看这篇之前,如果您还不了解直播原理,请查看这篇文章如何快速的开发一个完整的iOS直播app(原理篇)开发一款直播app,美颜功能是很重要的,如果没有美颜功能,可能分分钟钟掉粉千万,本篇主要讲解直播中美颜…

Linux内核分析——第五章 系统调用
第五章 系统调用 5.1 与内核通信 1、系统调用在用户空间进程和硬件设备之间添加了一个中间层,该层主要作用有三个: (1)为用户空间提供了一种硬件的抽象接口 (2)系统调用保证了系统的稳定和安全 (…

BZOJ 3110
http://www.lydsy.com/JudgeOnline/problem.php?id3110 整体二分区间修改树状数组维护 #include<cstdio> #define FOR(i,s,t) for(register int is;i<t;i) inline int max(int a,int b){return a>b?a:b;} inline int min(int a,int b){return a<b?a:b;} type…

css 选择器 伪元素_CSS伪元素-解释选择器之前和之后
css 选择器 伪元素选择器之前 (Before Selector) The CSS ::before selector can be used to insert content before the content of the selected element or elements. It is used by attaching ::before to the element it is to be used on.CSS ::before选择器可用于在选定…

各种面试题啊1
技术 基础 1.为什么说Objective-C是一门动态的语言? 什么叫动态静态 静态、动态是相对的,这里动态语言指的是不需要在编译时确定所有的东西,在运行时还可以动态的添加变量、方法和类 Objective-C 可以通过Runtime 这个运行时机制,…

PEP8 Python
写在前面 对于代码而言,相比于写,它更多是读的。 pep8 一、代码编排 缩进,4个空格的缩进,编辑器都可以完成此功能;每行最大长度79,换行可以使用反斜杠,换行点要在操作符的后边。类和top-level函…

粒子滤波 应用_如何使用NativeScript开发粒子物联网应用
粒子滤波 应用If youre developing any type of IoT product, inevitably youll need some type of mobile app. While there are easy ways, theyre not for production use.如果您要开发任何类型的物联网产品,则不可避免地需要某种类型的移动应用程序。 尽管有简单…

wkwebView基本使用方法
WKWebView有两个delegate,WKUIDelegate 和 WKNavigationDelegate。WKNavigationDelegate主要处理一些跳转、加载处理操作,WKUIDelegate主要处理JS脚本,确认框,警告框等。因此WKNavigationDelegate更加常用。 比较常用的方法: #p…

引用类型(一):Object类型
对象表示方式 1、第一种方式:使用new操作符后跟Object构造函数 var person new Object();<br/> person.name Nicholas;<br/> person.age 29; 2、对象字面量表示法 var person {name:Nicholas,age:29 } *:在age属性的值29的后面不能添加逗号…

(第四周)要开工了
忙碌的一周又过去了,这周的时间很紧,但是把时间分配的比较均匀,考研复习和各门功课都投入了一定的精力,所以不像前三周一样把大多数时间都花费在了软件工程上。也因为结对项目刚开始,我们刚刚进行任务分工以及查找资料…

统计数字,空白符,制表符_为什么您应该在HTML中使用制表符空间而不是多个非空白空间(nbsp)...
统计数字,空白符,制表符There are a number of ways to insert spaces in HTML. The easiest way is by simply adding spaces or multiple character entities before and after the target text. Of course, that isnt the DRYest method.有多种方法可以在HTML中插入空格。…

Python20-Day02
1、数据 数据为什么要分不同的类型 数据是用来表示状态的,不同的状态就应该用不同类型的数据表示; 数据类型 数字(整形,长整形,浮点型,复数),字符串,列表,元组…

Android网络框架-OkHttp3.0总结
一、概述 OkHttp是Square公司开发的一款服务于android的一个网络框架,主要包含: 一般的get请求一般的post请求基于Http的文件上传文件下载加载图片支持请求回调,直接返回对象、对象集合支持session的保持github地址:https://githu…

第一天写,希望能坚持下去。
该想的都想完了,不该想的似乎也已经尘埃落定了。有些事情,终究不是靠努力或者不努力获得的。顺其自然才是正理。 以前很多次想过要努力,学习一些东西,总是不能成,原因很多: 1.心中烦恼,不想学…

mac gource_如何使用Gource显示项目的时间表
mac gourceThe first time I heard about Gource was in 2013. At the time I watched this cool video showing Ruby on Rails source code evolution:我第一次听说Gource是在2013年 。 当时,我观看了这段很酷的视频,展示了Ruby on Rails源代码的演变&a…

insert语句让我学会的两个MySQL函数
我们要保存数据到数据库,插入数据是必须的,但是在业务中可能会出于某种业务要求,要在数据库中设计唯一索引;这时如果不小心插入一条业务上已经存在同样key的数据时,就会出现异常。 大部分的需求要求我们出现唯一键冲突…

对PInvoke函数函数调用导致堆栈不对称。原因可能是托管的 PInvoke 签名与非托管的目标签名不匹配。...
C#引入外部非托管类库时,有时候会出现“对PInvoke函数调用导致堆栈不对称。原因可能是托管的 PInvoke 签名与非托管的目标签名不匹配”的报错。 通常在DllImport标签内加入属性CallingConventionCallingConvention.Cdecl即可解决该问题。 如: [Dll…

Python字符串方法用示例解释
字符串查找方法 (String Find Method) There are two options for finding a substring within a string in Python, find() and rfind().在Python中的字符串中有两个选项可以找到子字符串: find()和rfind() 。 Each will return the position that the substring …

关于命名空间namespace
虽然任意合法的PHP代码都可以包含在命名空间中,但只有以下类型的代码受命名空间的影响,它们是:类(包括抽象类和traits)、接口、函数和常量。在声明命名空间之前唯一合法的代码是用于定义源文件编码方式的 declare 语句…

一 梳理 从 HDFS 到 MR。
MapReduce 不仅仅是一个工具,更是一个框架。我们必须拿问题解决方案去适配框架的 map 和 reduce 过程很多情况下,需要关注 MapReduce 作业所需要的系统资源,尤其是集群内部网络资源的使用情况。这是MapReduce 框架在设计上的取舍,…

huffman树和huffman编码
不知道为什么,我写的代码都是又臭又长。 直接上代码: #include <iostream> #include <cstdarg> using namespace std; class Node{ public:int weight;int parent, lChildren, rChildren;Node(int weight, int parent, int lChildren, int …

react 监听组合键_投资组合中需要的5个React项目
react 监听组合键Youve put in the work and now you have a solid understanding of the React library.您已经完成工作,现在对React库有了扎实的了解。 On top of that, you have a good grasp of JavaScript and are putting its most helpful features to use …

Unity 单元测试(PLUnitTest工具)
代码测试的由来 上几个星期上面分配给我一个装备系统,我经过了几个星期的战斗写完90%的代码. 后来策划告诉我需求有一定的改动,我就随着策划的意思修改了代码. 但是测试(Xu)告诉我装备系统很多功能都用不上了. Xu: 我有300多项测试用例,现在有很多项都无法运行了. 你修改了部分…

Best Time to Buy and Sell Stock II
题目: Say you have an array for which the i th element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one and sell one share of the stock multipl…

求给定集合的幂集
数据结构中说这个问题可以用类似8皇后的状态树解法。 把求解过程看成是一棵二叉树,空集作为root,然后遍历给定集合中的元素,左子树表示取该元素,右子树表示舍该元素。 然后,root的左右元素分别重复上述过程。 就形成…