• About Us
  • Blog
  • Basket
  • Account
  • Sign In

Java V3.1 Documentation

You are viewing an old version of the documentation. For the latest, please go here: Java V3.2

Match Metrics

If you are using our Pattern algorithm, then you have access to the match metrics described below. Currently Trie does not support this feature.

Consider the following code snippet:

Provider p = new Provider(StreamFactory.create("path\\to\\file.dat", false));
Match m = p.match(SomeUserAgentString);
System.out.println("Id: "+m.getDeviceId());
System.out.println("Detection method: "+m.getMethod());
System.out.println("Difference: "+m.getDifference());
System.out.println("Rank: "+m.getSignature().getRank());

The above code will print out device Id, detection method, difference and rank.

Id: consists of four numbers separated by hyphens. Each number is the profile Id chosen for the relevant component. The first number is the profile for the Hardware component. Second number is the profile for the Platform component. Third number is the profile for the Browser component. Last number is the profile for the IsCrawler component.

Detection method: provides information as to what method has been used to detect the device and represents how confident the detector is in the current results. For a full description of methods and an example for each please see the how pattern device detection works page. Exact method means that all characters were found in exactly where expected. On the other hand the None detection method signals that the provided user agent string is a random collection of characters and is almost guaranteed to be fake. Other methods like Numeric, Closest and Nearest indicate that some of the characters in the string were different to what we would expect them to be and that you should check the Difference.

Difference: is represented as a number and only returned where Numeric, Nearest or Closest detection methods are used. It gives you the difference between what was expected and what was observed. For more information and examples please see the how pattern device detection works page. The higher the number the larger the difference.

Rank: is the numeric representation for the popularity of the signature that the User-Agent was matched to. The lower the number the more popular this signature is.

Practical application

Match metrics information can be combined to improve user experience. Following are just some of the examples:

  • If a user accessing your website was matched using the None detection method you should consider asking the user if they actually want a mobile or a desktop version of the website before returning the page.
  • When creating reports you can remove some of the data lags by excluding devices that were identified using either the None detection method or have a very large difference for the Nearest, Closest or Numeric methods.
  • Even if you know the name and the model of your most frequently encountered mobile devices you may not know how popular these devices are. Using signature rank information you can discover more about the popularity of devices that are used to access your website. This information can potentially be used to improve your understanding of the demographics of your users.
  • You can augment systems like Google Analytics with one of the profile Ids instead of the individual properties. This helps you track an entire collection of properties that the profile contains instead of individual properties.
  • More popular devices generally have a better support of modern technologies. The lower the rank of the detected signature the more popular the device is and therefore the safer it is to provide content other than HTML, CSS and images.