API Docs for: 2.1.0
Show:

Config Class

DeviceApi Configurations. To change the default configs of the DeviceAtlas DeviceApi create an instance of this class, set your preferred configs and pass the instance to the constructor of a DeviceApi or DeviceApiWeb. Note that you may change the configs even after the Config instance has been passed to the DeviceApi.

If config is empty, for example new Config(), default values are used.

Constructor

Config

(
  • config
)

Parameters:

  • config Object

Example:

var config = new Config();

var config = new Config({ cookieName: 'newCookieName', includeUaProps: false, includeLangProps: false, includeMatchInfo: false, maxCacheEntries: 0 });

{cookieName: 'foo'}

Attributes

cookieName

String optional

The cookie name that the client side properties would be set to. When using getProperties() the detection would automatically use the contents of this cookie if it exists. When the user-agent or HTTP headers are set manually to getProperties() the client side properties (probably the value set to the cookie) can be manually passed to this methods as the second argument, note that this config is only used for getProperties(REQUEST-OBJECT).

Default: 'DAPROPS'

includeLangProps

Boolean optional

To disable or enable getProperties(HEADERS) or getProperties(REQUEST) including language and locale properties. To check the Accept-Language header and include properties to the property set for getting client's language and locale preferences set to true. If you do not use this properties you can set this config to false to make the detection marginally faster.

Default: true

includeMatchInfo

Boolean optional

To disable or enable getProperties() including the matched and unmatched parts of the User-Agent to the property set.

Default: false

includeUaProps

Boolean optional

To disable or enable getProperties() including User-Agent dynamic properties. Some properties cannot be known before runtime and can change from User-Agent to User-Agent. The most common of these are the OS Version and the Browser Version. The DeviceApi is able to dynamically detect these changing properties with a small overhead. If you do not use this properties you can set this config to false to make the detection a little bit faster.

Default: true

maxCacheEntries

Number (Integer) optional

Set the max number of results to be cached. Depending on the repeat and distance factor of your user-agents or headers passed to the API for detection, increasing the result cache may increase performance by preventing repeated lookups. For a tight set of inputs (i.e. an almost unique set of user-agents) set to lower numbers or 0 to disable.

Default: 4096