Combines patented device detection with the simplicity of NGINX
This article was first published on the NGINX website on September 13th 2018.
51Degrees often receives queries from new clients using NGINX Plus load balancing, and need to implement a quality device intelligence solution for high fidelity analytics, increased conversion rates, and quality user experiences. The 51Degrees certified NGINX Plus module provides the starting point for that complete service, combining the fastest patented device detection with the simplicity of NGINX Plus.
With the 51Degrees NGINX Plus Certified Module, customers can perform device detection at the network layer. Thus, they benefit from the speed and accuracy available in the C language API, while enabling any applications downstream to utilize the device data regardless of the programming language they are written in.
Why use device detection?
- Optimized for specific devices - Modern high traffic websites and programmatic environments must serve millions or even billions of concurrent requests from users or clients every day. These websites, apps, and ads need to return the correct text, images, video, or application data, all optimized for the user’s specific device, screen size, and configuration - and all in a fast and reliable manner. When it comes to website performance and conversion, a responsive design alone is not the answer.
- Personalized without compromising user privacy - Website personalization and the EU’s General Data Protection Regulation (GDPR) are hot topics. The device, its price, age, and performance can all be captured in real time without requiring personal information. First request personalization is simple with device detection.
- Analyzed for continual improvement - Granular device information can be fed to analytics solutions for insight into customer behavior. This enables you to understand how physical screen size, CPU performance, and device age affect checkout completion rates and data capture, and to tweak web page design accordingly.
Optimizing, Personalizing, and Analyzing with 51Degrees in Programmatic Advertising
Consider the programmatic advertising world as an example: here, placing and presenting the right ads to the right viewer at the right time is incredibly complex. Many ads are dynamically selected for individual users through a real time bidding process that occurs behind the scenes, within milliseconds of the user sending a request. Part of this process includes identifying the device and its characteristics for targeting purposes. Companies need sub millisecond speed, consistency, and accuracy in their data sets. Leading programmatic advertisers and publishers like Seznam, Adform, Centro, and Adyoulike use 51Degrees to process many millions of bid requests per second.
Why Implement 51Degrees Device Intelligence?
Companies select 51Degrees because of the speed and accuracy of our solution. We are the only commercial open source solution available. All source code is licensed under the Mozilla Public license version 2.
How Device Detection Works
51Degrees' NGINX hosted, high performance device detection works out the type of device in less than 1 millisecond, using fingerprints (HTTP headers including User-Agent) representing circa 3,002,817 combinations of browser versions, operating system versions, and device models. Your website returns a page optimized for the precise screen size and device type, ensuring that the tech does not get in the way of performance and user experience.
Speed of response and accuracy are important for delivering an optimal user experience, personalization, and high‑fidelity analytics. 51Degrees performs with better than 99.9% matching accuracy. Its algorithm is capable of more than 22 million detections per second on a single CPU!
Device Combinations
51Degrees has a growing database of approximately 1 million device combinations. 51Degrees adds to this database every day, providing information such as retail price, vendor, screen size, OS version, device age, browser, currency, and many more permutations of device properties.
Three key components are used in the process:
- Physical device and model (smartphone, tablet, smart TV, etc.)
- Operating system (Android, iOS, etc) and version
- Web browser / application (Chrome, Safari, etc./ Facebook, LinkedIn, etc.)
A way to visualize this is as a cube with these components as dimensions. The cube is always expanding, as new device models come into the market, and new versions of operating systems, browsers, and apps come into use. 51Degrees data provides global coverage.
Configuring the 51Degrees NGINX Plus Certified Module
Installing the 51Degrees NGINX Plus Certified Module requires no changes to the existing web server implementation. All the processing work is done during NGINX Plus’ request cycle, and the properties of the device are simply passed to the web server as additional HTTP headers. In addition to User-Agent matching, the module supports matching against multiple HTTP headers with no extra code, to catch tricky browsers like Opera Mini and the hugely popular UC Browser.
The 51Degrees NGINX Plus Certified Module can be used with NGINX Plus R9 (open source 1.9.13) and later. NGINX Plus R11 (open source 1.11.5) introduced the capability to compile dynamic modules independently, and we provide prebuilt modules for reference in the nginx/modules directory of our GitHub repo. To build a module for other NGINX Plus releases, see the instructions in the module README.
Note: As standard our GitHub repository contains a Lite data file for on‑premises deployments which is only pulled if you have Git LFS installed. To compare the available data‑file options, see Our Licenses & Pricing.
If required, you can download our enhanced data file from the website after subscribing and replace the existing reference, as shown in the example below, in your local installation.
Enabling the Module
ou enable 51Degrees device detection on an NGINX Plus server with just one line in the configuration, defining the data file. Add the 51D_filePath directive in the http block:
51D_filePath path/to/51Degrees.dat;
Then you can add device properties as additional request headers by adding the 51D_match_all directive in a location or server block. This example adds an additional request header named x-device which contains the values of the listed properties.
51D_match_all x-device DeviceType,PlatformName,HardwareName;
No device‑detection solution provides 100% accuracy. With 51Degrees the metrics about the accuracy of the match can also be retrieved by adding the 51D_match_all with the metric properties Method, Difference, and Rank:
51D_match_all x-metrics DeviceId,Method,Difference,Rank;
Where the results are suspect, the consuming application might revert to default behavior or exclude the data from the analysis.
With these directives in the configuration, two headers are added to all incoming requests. The first header, x-device, contains information about the device. The second header, x-metrics, contains match metrics, which indicate the accuracy of the match and the popularity of the device combination.
Carrying out device detection in this way makes web optimization easier by removing the need for any software integration on an existing website. All that is needed is an if statement such as if tablet or if smartphone. The latency for a request when using the 51Degrees NGINX Plus module is as little as 0.001 milliseconds on an i7 or similar processor.
Full benchmarking results can be found in the developer documentation on our website.
Video Tutorial
In February 2018 we published a blog containing a video tutorial for developers which explains how to set up our device‑detection solution on a Linux machine using NGINX Plus. It demonstrates how to add properties to call from the data file and check that the results are being returned as response headers on the site.
This video tutorial does not cover installing NGINX Plus, but instructions are provided in the NGINX Plus Admin Guide, which also provides instructions for building open source NGINX from source.
About 51Degrees
51Degrees provides device intelligence for over 1.5 million websites around the world, including global brands like Adform, Basis Technologies, Dynata (Research Now), EPAM, Open Text Corporation, Sitecore, and more.
Since launching in 2011, our patented solution has changed the device‑detection industry by being the first to introduce native app support, pricing data, and meaningful metrics such as device combinations and accuracy metrics. Read more about our industry firsts.
51Degrees’ unique algorithm provides a solution that can meet the sub‑millisecond performance demanded of a high traffic‑volume environment without sacrificing accuracy. The 51Degrees NGINX Plus Certified Module comes with free access to the 51Degrees Lite data file which contains 62 device properties such as IsMobile, ScreenPixalsWidth and height, PlatformName (operating system), and more. Subscription-based options with weekly and daily data file updates are available. For those wanting access to properties like price and age of device, these are included in our Enterprise data file which contains over 222 device properties and about 1 million device combinations.
More Resources
The 51Degrees NGINX Plus Certified Module
NGINX developer documentation on the 51Degrees website
51Degrees Device Data file comparisons - Property Dictionary
Enhanced data file subscription options - Pricing and Licensing