Digital Agencies

Leading digital agencies need to keep up to date with the latest trends and tool sets to ensure your clients get the best results can be a challenge when you are busy managing the day to day demand from clients.

Using 51Degrees you can adapt online content to maximise the potential of online conversions and steer the end user purchase path.

Plugin us into yours and your clients’ web platforms and see a more granular level of detail about the devices used for clients site.

CMS

51Degrees provides the fastest and most accurate device information, including 217 device properties such as retail price, vendor, device age, screen size and more to allow more granular analytics and better content optimisation

APIs

Property Dictionary

Browse the full list of properties available in 51Degrees device detection solutions. Find out what values are supported in the Lite, Premium and Enterprise data sets, including full descriptions and advice on how they can be used.

Mobile Emulators

Blog

How to Build 51Degrees Device Detection as an NGINX Dynamic Module

In this tutorial video we show you how to build 51Degrees Device Detection as an NGINX Dynamic Module.

51Degrees are certified as an NGINX module. We thought we’d put together a tutorial showing how you can integrate our Device Detection API into your NGINX Server. In this video we go through how to set up our device detection solution on a Linux machine using NGINX, add properties to call from the data file and finally check that the results are being returned as response headers on the site.

;

Intro

This video was put together by Josh, one of our engineers at 51Degrees.

In this video we will go through the initial setup, adding properties to call from the data file and finally checking that the results are being returned as response headers on the site.

We don’t cover installing NGINX but here is a link with guidelines on how to build it from source.

With version 1.11.5 NGINX introduced the capability to compile dynamic modules independently which is what we will be doing.

It is possible to install Device Detection using an earlier version but it’s not something we will cover in this tutorial. If you need any help you can get in touch with us.

It’s important to check you have ‘—with-compat’ available as a configure argument. You can check this by doing:

Nginx -V

From there you can see the version of NGINX you are running as well as all the configure arguments.

Downloading and building the dynamic module

The first thing you are going to need to do is download our Repository. 51Degrees is an open source product so you can get this by going to our GitHub.

git clone https://github.com/51Degrees/Device-Detection.git

Copy over your 51Degrees data file into the cloned repository.

cp path/to/51Degreesdatafile.trie Device-Detection/data

Move into the 51Degrees NGINX directory.

cd Device-Detection/nginx/

NOTE: The next few steps are not required to install as a dynamic module but is recommended as it contains tests that allow you to see any potential issues during install. You will need to edit the Makefile so that the tests are referencing the correct data file.

nano Makefile

Dependent on whether you are using Pattern or Hash Trie, change the name of the data file in code below and save.

Now configuration is complete, you can connect to your web server via an Internet browser and open up the developer tools. If you reload the page when on the network tab you will be able to see the 2 matches we have created returning as response headers.

Try emulating a few different devices to see the results.

Note: If you use a tablet, x-mobile will return true as, within our data base, we count tablets as "mobile" because you can use it while you are walking down the street. if you were to call the "IsSmartphone" property instead of "IsMobile" then a tablet would return as false.