简体   繁体   中英

How 'google analytics web' knows name of mobile device with javascript?

来自Google Analytics(分析)页面

Hi.

I'm tracking some mobile pages with google analytics. And I found an interesting thing that google knows which devices visited the pages.

How google analytics detects specific device name (model name like Samsung SHV-E250S) with javascript not only device type(iPhone, Android or Windows)?

From browser's UserAgent, we can achieve model number(such as iPhone OS 3_0, LG-L160L) of the device.
So from that data, google can assume what device is it.

There is an open source solution called WURFL which has a database of devices. If you were looking to replicate this system you could use a server side API that WURFL supports and query the user string which can return the make and model.

http://wurfl.sourceforge.net

Self-answer

I found model name in userAgent like below.

Mozilla/5.0 (Linux; Android 4.1.2; SHV-E210S Build/JZO54K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.92 Mobile Safari/537

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM