/*
https://github.com/Valve/fingerprintjs2
<script src="//cdn.jsdelivr.net/npm/fingerprintjs2@<VERSION>/dist/fingerprint2.min.js"></script>
*/
//can pass an object with options: https://github.com/Valve/fingerprintjs2/wiki/List-of-options
var options = {
swfPath: '/assets/FontList.swf', excludeUserAgent: true,
userDefinedFonts: ["Nimbus Mono", "Junicode", "Presto"], //increase the entropy of the font fingerprint
//Function that is called with each component value that may be used to modify component values before computing the fingerprint
preprocessor: function(key, value) {
//ie: strip browser version from user agent
if (key == "user_agent") {
var parser = new UAParser(value); // https://github.com/faisalman/ua-parser-js
var userAgentMinusVersion = parser.getOS().name + ' ' + parser.getBrowser().name
return userAgentMinusVersion
} else {
return value
}
}
}
new Fingerprint2(options).get(function(result, components) {
console.log(result) // a hash, representing your device fingerprint
console.log(components) // an array of FP components
});