通过 Web 请求从设备获取唯一的静态 ID [英] Get unique, static id from a device via web request

查看:66
本文介绍了通过 Web 请求从设备获取唯一的静态 ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 MVC 应用程序,我想向其中添加一些自定义统计信息.对于某些统计数据,设备最好有一个唯一标识符.

例如,如果我有一个 RSS 订阅者的唯一 ID,我可以监控 RSS 订阅者的活跃数量.

我想知道是否有人知道网络请求中可以用作 IP 以外的 ID(显然可以更改)的任何内容.诸如设备 ID 之类的东西?

谢谢,

奥利弗

解决方案

这里有一些方法可以考虑.

HTTP 标头

您可以查看一些 HTTP 标头,它们可以帮助您识别唯一的用户或设备 - 有些是指 SIM 卡,有些是指设备.以下是我从 Google Adsense Mobile 用来帮助跟踪其广告的标头中得出的列表:

  • x-dcmguid
  • x-up-subno
  • x-jphone-uid
  • x-em-uid

这些可能是一些非常受欢迎的标头,但会有更多供应商/设备特定的标头更受欢迎.您可以开始收集您的网站收到的所有标头并计算您收到的每个标头的数量,然后开始构建您自己的通用标头数据库.

其他一些方法

饼干

Cookies 是可以在请求代理(例如浏览器)上设置并在代理再次访问时返回的东西.有关方法列表,请查看 Ever Cookie - 几乎永久的 cookie - 它使用以下方法之一起作用至少有一种方法可以工作:

<块引用>

 - 标准 HTTP Cookie- 本地共享对象(Flash Cookies)- Silverlight 独立存储- 将 cookie 存储在自动生成的、强制缓存的 RGB 值中使用 HTML5 Canvas 标签读取像素 (cookies) 的 PNG- 在网络历史记录中存储 cookie- 在 HTTP ETags 中存储 cookie- 在 Web 缓存中存储 cookie- window.name 缓存- Internet Explorer 用户数据存储- HTML5 会话存储- HTML5 本地存储- HTML5 全局存储- 通过 SQLite 的 HTML5 数据库存储

组合

也可以提出自己的方案,例如取 user-agent 标头,其他一些标头,如 acceptx-fowarded-for 和 IP 为它们生成唯一的哈希值更准确地确定代理的唯一性.

这里有许多不同的移动标题.我还点击了我的一个页面并在此处为我自己的目的存储来自各种设备的移动标题 http://wap.defza.com/ua/ua.txt(还有ua1.txt、ua2.txt等)

I have an MVC application that I would like to add some custom stats to. For some of the stats, it would be nice to have a unique identifier for a device.

For example, if I have a unique id for a RSS subscriber, I can monitor the active number of RSS subscribers.

I was wondering if anyone knew of anything in the web request that could be used as an ID other than the IP (which can obviously change). Something like a device ID or something?

Thanks,

Oliver

解决方案

Here are some approaches to consider.

HTTP Headers

There are a few HTTP Headers you can look at that can help you identify a unique user or device - some would refer to the sim card, some refer to the device. Here is a list that I derived from the headers that Google Adsense Mobile uses to help track their advertising:

  • x-dcmguid
  • x-up-subno
  • x-jphone-uid
  • x-em-uid

These are probably some very popular one's, but there would be more vendor/device specific headers that are popular. You could start gathering all the headers your site receives and count how many of each you receive and start building up your own database of common headers.

Some other approaches

Cookies

Cookies is something that can be set on the requesting agent (browser for example) and returned when the agent visits again. For a list of methods, check out Ever Cookie - the virtually permanent cookie - it works by using one of the following methods of which at least one will work:

 - Standard HTTP Cookies 
 - Local Shared Objects (Flash Cookies)
 - Silverlight Isolated Storage 
 - Storing cookies in RGB values of auto-generated, force-cached 
    PNGs using HTML5 Canvas tag to read pixels (cookies) back out
 - Storing cookies in Web History 
 - Storing cookies in HTTP ETags 
 - Storing cookies in Web cache 
 - window.name caching
 - Internet Explorer userData storage
 - HTML5 Session Storage 
 - HTML5 Local Storage 
 - HTML5 Global Storage 
 - HTML5 Database Storage via SQLite

Combinations

It's also possible to come up with your own scheme, e.g. take the user-agent header, some other headers like accept, x-fowarded-for and the ip make a unique hash value of out them to more accurately determine the uniqueness of the agent.

There are many different mobile headers as seen here. I also hit a page of mine and store mobile headers from various devices for my own purposes here http://wap.defza.com/ua/ua.txt (also ua1.txt, ua2.txt etc)

这篇关于通过 Web 请求从设备获取唯一的静态 ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆