This example shows how to obtain further metrics for 51Degrees' on-premise device detection in Nginx.
This example shows how to obtain further metrics for 51Degrees' on-premise device detection in Nginx. The available metris are Drift, Difference, Method, UserAgents, DeviceId and MatchedNodes. This example is available in full on GitHub.
This example requires a local data file. The free 'Lite' data file can be downloaded with the
scripts in the data GitHub repository, which
this repository includes at cxx/data. Fetch the submodules by running
git submodule update --init --recursive, then run
sh cxx/data/get-data-files.sh 51Degrees-LiteV4.1.hash from the repository root,
which saves the file as cxx/data/device-detection/51Degrees-LiteV4.1.hash.
The Lite data file is only used for illustration, and has limited accuracy and capabilities. The Enterprise data file has every property. Contact us about a copy.
Make sure to include at least IsMobile property for this to work.
Before using the example, update the followings:
- Remove this 'how to' guide block.
- Update the %%DAEMON_MODE%% to 'on' or 'off'.
- Remove the %%TEST_GLOBALS%%.
- Update the %%MODULE_PATH%% with the actual path.
- Remove the %%TEST_GLOBALS_HTTP%%.
- Update the %%FILE_PATH%% with the actual file path.
- Replace the nginx.conf with this file or run Nginx with
-coption pointing to this file. - Create a static file
metricsin the Nginxdocument_root.
In a Linux environment, once Nginx has started, run the following command:
Expected output:
NOTE: All the lines above, this line and the end of comment block line after this line should be removed before using this example.
