Options
You can pass your options to Thumbmark when instantiating the Thumbmark
class, like so:
const t = new Thumbmark({ api_key: 'xxxxxxxxxxx', exclude: ['permissions'], timeout: 7000 })
The ThumbmarkJS GitHub page will have the most up-to-date information of the available options.
API key
The API key is not mandatory. However, providing a valid API key allows ThumbmarkJS to utilize server side fingerprinting components, which drastically improve the fingerprinting from 90% to 99% uniqueness.
You can obtain a free API key from the ThumbmarkJS console.
A free API key gives you 1,000 API requests per month.
Provide the API key like so:
const t = new Thumbmark({ api_key: 'xxxxxxxxxxx' })
Include
include
is a way to only include listed fingerprinting components. include
is only applied to client components, not server-side components.
include
takes a list of strings. You can provide a top-level component name in include such as ['canvas', 'audio']
. You can also use dot-separation to pick not the whole component, but pieces of the component, like ['system.browser.name', 'webgl']
. This would pick the whole webgl component, and the browser name from system, nothing else.
Usage:
const t = new Thumbmark({ exclude: ['permissions'] })
Exclude
exclude
works similarly to include
but excludes the listed components. It also only applies to client components.
Usage:
const t = new Thumbmark({ include: ['canvas', 'audio', 'webgl'] })
Timeout
There is a default timeout for calculating the fingerprinting components of 5,000 milliseconds. This is plenty typically, as it should not take even near this long to calculate the fingerprint. However, if you need to adjust this, you can do so as follows:
Usage:
const t = new Thumbmark({ timeout: 7000 })
Stabilize
stabilize
is a set of predefined settings that thumbmark can be configured to stabilize for. For example, stabilizing for private
means components that can differ between normal and private browsing will be excluded.
stabilize
takes a list of strings and can currently take private
, iframe
and vpn
.
The default value is ['private', 'iframe']
.
Usage:
const t = new Thumbmark({ stabilize: ['private', 'iframe'] })
Logging
Logging is enabled by default, but with this option it can be disabled.
When logging is enabled, ThumbmarkJS randomly logs the components for 0.01% calculated thumbmarks. This sampled data is used for analysis purposes in order to improve the free ThumbmarkJS fingerprinting library.
To disable logging:
const t = new Thumbmark({ logging: false })
Performance
If performance is a topic for you, you can expose the amount of milliseconds each component takes to resolve by setting performance
to true