This document discusses the importance of user-agent strings for mobile apps and websites. It notes that the majority of web traffic now comes from mobile devices. It provides guidance on constructing meaningful user-agent strings for native mobile apps, hybrid apps, and mobile webviews. Specifically, it recommends prepending the app name and version for native apps and appending it for hybrid and webview apps. The document also discusses how user-agent strings can be used to gather device and platform statistics, optimize content delivery, and improve debugging and monitoring.
3. 80% MOBILE
In India, and most of Asia, mobile is the main concern
0
25
50
75
100
2009-01 2010-01 2011-01 2012-01 2013-01 2014-01 2015-01 2016-01 2017-01
Desktop Mobile Tablet Console
statcounter.com
Aug. 2012
14. The "User-Agent" header field contains information about the user
agent originating the request, which is often used by servers to help
identify the scope of reported interoperability problems, to work
around or tailor responses to avoid particular user agent
limitations, and for analytics regarding browser or operating system
use.
The User-Agent field-value consists of one or more product
identifiers, each followed by zero or more comments (Section 3.2 of
[RFC7230]), which together identify the user agent software and its
significant subproducts. By convention, the product identifiers are
listed in decreasing order of their significance for identifying the
user agent software. Each product identifier consists of a name and
optional version.
#devops
#BFF
15. Format:
User-Agent = product *( RWS ( product / comment ) )
MostSignificant/1.0 Significant/1.1 LessSignificant
significancehigh low
Name of the “thing” “Thing” version White space
18. OK, IT’S A MESS
…but what can we do with our apps?
19. THREE KINDS OF APPS
• (Progressive) Web Apps
• Hybrid Apps
• Native Apps
…for simplicity
Run in the browser.
We’re good.
An app, but loads web
content/pages
Native code using APIs
to communicate
40. 0 Mbps
35 000 000 Mbps
70 000 000 Mbps
105 000 000 Mbps
140 000 000 Mbps
Time
Actual Bandwidth Usage For Optimized Objects Original Bandwidth Usage For Non-Optimized Objects
IS IT WORKING?
41. IS IT WORKING?
• 75%-ish less data
transmitted
• No visual quality loss
• >50% of images converted
to different formats
• In apps, most images resized
• Faster loading UI
traffic
Original Optimized
42. MEANINGFUL USER-AGENTS
• Would have been too romantic sticking with the
standard
• The real world is a mess with historical “mistakes”
that stick with us.
MostSignificant/1.0 Significant/1.1 LessSignificant
significancehigh low
Name of the “thing” “Thing” version White space
43. MEANINGFUL USER-AGENTS
• Rule of thumb:
• Native apps: Prepend app name/version
• Hybrid apps: Append app name/version
• Special rule for iOS
• Include hardware info
44. MEANINGFUL USER-AGENTS
Default Recommended
iOS MyApp/1 CFNetwork/808.3 Darwin/16.3.0 MyApp/1 iPhone5,2 iOS/10_1 CFNetwork/808.3 Darwin/16.3.0
Android
Dalvik/2.1.0 (Linux; U; Android 6.0.1;
vivo 1610 Build/MMB29M)
Myapp/1 Dalvik/2.1.0 (Linux; U; Android 6.0.1; vivo 1610
Build/MMB29M)
Default Recommended
iOS
Mozilla/5.0 (iPhone; CPU iPhone OS 11_1
like Mac OS X) AppleWebKit/604.3.5
(KHTML, like Gecko) Mobile/15B93
Mozilla/5.0 (iPhone; CPU iPhone OS 11_1 like Mac OS X)
AppleWebKit/604.3.5 (KHTML, like Gecko) Mobile/15B93
WebViewApp MyApp/1 iPhone4,1
Android
Mozilla/5.0 (Linux; Android 5.1.1; Nexus
5 Build/LMY48B; wv) AppleWebKit/537.36
(KHTML, like Gecko) Version/4.0 Chrome/
43.0.2357.65 Mobile Safari/537.36
Mozilla/5.0 (Linux; Android 5.1.1; Nexus 5 Build/LMY48B)
AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0
Chrome/43.0.2357.65 Mobile Safari/537.36 WebViewApp
MyApp/1
Native apps
Hybrid apps