Custom User Agent Guide - AxiomBenchmark/Axiom GitHub Wiki
Summary
When executing a benchmark run on Axiom, the user platform's browser automatically provides the benchmark a User Agent, a parameter that details the type of platform on which the user is operating. This User Agent details the name of the browser, operating system name and version, and the user agent type (desktop, mobile, etc.). This information is stored in the database with the corresponding benchmark test results, and is further utilized by the reporting engine to compare and contrast benchmark runs and long-run metrics. However, the client browser may not provide the necessary information for every single platform. The Custom User Agent tool allows the developer to set these database parameters for their platform if a certain browser doesn't automatically provide them.
When the benchmark agent is launched, it creates a new benchmark object in the database. This benchmark object ingests the User Agent from the client's browser, and interprets it in a string format, called the User Agent string, to be parsed into the database. If the User Agent information appears in CustomRules.js, then the benchmark retrieves the information regarding that User Agent and parses it into the User Agent string.
Creating a Custom User Agent
As stated previously, the archive for custom User Agent rules is stored in the CustomRules.js. CustomRules.js exports these rules as an array of JSON objects. Each JSON object represents a custom User Agent implemented by the developer. Below is an example of a custom User Agent for a Comcast set top box device:
module.exports = [
{
"contains" : "Comcast",
"set" : {
"ua_type" : "STB",
"os_name" : "Comcast",
"os_version" : null,
"browser_name" : "Comcast"
}
}
]
The contains key is the parameter initially checked by the benchmark object when receiving the User Agent string. In this example, if the generated User Agent string is Comcast, then the benchmark object sets the User Agent type to STB (set top box), the operating system name and browser name to Comcast and the operating system to null. Any parameters not set in CustomRules.js for a custom User Agent will be stored as "Unknown" in the database.