问题描述
我正在使用分析工具.我希望能够合理地识别唯一用户(或更可能是唯一机器)-一定程度的准确性是可以的.我需要同时支持低级设备(Android/iOS)和Web(JS/Flash),因为我正在Haxe中构建客户端. (另一个警告是我不能使用特定语言的API.)
I'm working on an analytics tool. I would like to be able to reasonably identify unique users (or more likely, unique machines) -- some degree of inaccuracy is okay. I need to support both low-level devices (Android/iOS) and web (JS/Flash), because I'm building the clients in Haxe. (The other caveat of this is that I can't use language-specific APIs.)
以前,我使用(ip, mac address)
元组来唯一标识用户.但是,在Flash(和Javascript)中,您无权访问mac地址.我想到应该在服务器端存储和管理身份,也许可以使用GUID.客户端会从服务器请求一个GUID(或某种ID),并将其用于来自同一设备的任何后续请求.
Previously, I used the tuple of (ip, mac address)
to uniquely identify users. However, in Flash (and Javascript), you don't have access to the mac address. It occurred to me that I should store and manage identity on the server side, perhaps with a GUID. The client would request a GUID (or some sort of ID) from the server, and use that for any subsequent requests from the same device.
但是,我不确定GUID是否是个好主意.还是我应该补充IP或其他信息. (我确实可以从客户端获取IP.)
However, I'm not sure if a GUID is a good idea; or if I should supplement it with the IP or other information. (I do have access to get the IP from the client side.)
客户端上的工作流程为:
The workflow on the client would be:
- 检查存储的唯一标识符
- 如果存在,请发送所有请求
- 如果没有,请打电话要求一个唯一的标识符并将其存储
- 在以后的所有调用中发送唯一标识符
当然,这对于每个设备来说都是唯一的,并且可能有一些方法可以通过删除本地设备上的标识符来误判两个用户.
Of course, this would only be unique per device, and there may be some way to get a false positive of two users by removing the identifier on the local device.
在服务器端,这就像生成新的GUID并在用户请求唯一标识符时将其发送给用户一样简单.
On the server side, it would be as simple as generating a new GUID and sending it to the user when they request a unique identifier.
这是一个好方法吗?有更好的方法吗?
Is this a good approach? Is there a better approach?
推荐答案
根据您所需要的唯一性和安全性级别,您可以考虑使用永久cookie . Cookie可能是您在工作流程中描述的唯一标识符.并且为了确保Cookie将通过后续请求发送,它应该是永久cookie .
Depending on the level of uniqueness and security you need you might consider using persistent cookies. The cookie could be the unique identifier you described in your workflow. And to ensure that the cookie will be sent over subsequent requests it should be a persistent cookie.
这篇关于Mac地址之外:在服务器端唯一标识设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!