How to store user's data using fingerprintjs

Hi,

I want to use fingeprintjs (open source version) to collect user’s data and then send it to Snowplow.

What’s the best way of doing it? Is it custom context and do I need to create custom scheme for it?

I get JSON response from fingerprintjs like this:

{
	"visitorId": " ",
	"confidence": { "score": 0.5, "comment": "0.995 if upgrade to Pro: https://fpjs.dev/pro" },
	"components": {
		"fonts": { "value": [], "duration": 23 },
		"domBlockers": { "duration": 11 },
		"fontPreferences": {
			"value": { "default": 0, "apple": 0, "serif": 0, "sans": 0, "mono": 0, "min": 0, "system": 0 },
			"duration": 16
		},
		"audio": { "value": 124.04347657808103, "duration": 12 },
		"screenFrame": { "value": [ 30, 0, 0, 0 ], "duration": 2 },
		"osCpu": { "duration": 0 },
		"languages": { "value": [ [ "en-GB" ] ], "duration": 0 },
		"colorDepth": { "value": 30, "duration": 0 },
		"deviceMemory": { "value": 8, "duration": 0 },
		"screenResolution": { "value": [ 1792, 1120 ], "duration": 0 },
		"hardwareConcurrency": { "value": 12, "duration": 0 },
		"timezone": { "value": "Europe/X", "duration": 1 },
		"sessionStorage": { "value": true, "duration": 0 },
		"localStorage": { "value": true, "duration": 0 },
		"indexedDB": { "value": true, "duration": 0 },
		"openDatabase": { "value": true, "duration": 0 },
		"cpuClass": { "duration": 0 },
		"platform": { "value": "MacIntel", "duration": 0 },
		"plugins": {
			"value": [
				{
					"name": "PDF Viewer",
					"description": "Portable Document Format",
					"mimeTypes": [
						{ "type": "application/pdf", "suffixes": "pdf" },
						{ "type": "text/pdf", "suffixes": "pdf" }
					]
				},
				{
					"name": "Chrome PDF Viewer",
					"description": "Portable Document Format",
					"mimeTypes": [
						{ "type": "application/pdf", "suffixes": "pdf" },
						{ "type": "text/pdf", "suffixes": "pdf" }
					]
				},
				{
					"name": "Chromium PDF Viewer",
					"description": "Portable Document Format",
					"mimeTypes": [
						{ "type": "application/pdf", "suffixes": "pdf" },
						{ "type": "text/pdf", "suffixes": "pdf" }
					]
				},
				{
					"name": "Microsoft Edge PDF Viewer",
					"description": "Portable Document Format",
					"mimeTypes": [
						{ "type": "application/pdf", "suffixes": "pdf" },
						{ "type": "text/pdf", "suffixes": "pdf" }
					]
				},
				{
					"name": "WebKit built-in PDF",
					"description": "Portable Document Format",
					"mimeTypes": [
						{ "type": "application/pdf", "suffixes": "pdf" },
						{ "type": "text/pdf", "suffixes": "pdf" }
					]
				}
			],
			"duration": 1
		},
		"canvas": {
			"value": {
				"winding": true,
				"geometry": "data:image/png;base64,test",
				"text": "data:image/png;base64,test"
			},
			"duration": 39
		},
		"touchSupport": { "value": { "maxTouchPoints": 1, "touchEvent": true, "touchStart": true }, "duration": 0 },
		"vendor": { "value": "Google Inc.", "duration": 0 },
		"vendorFlavors": { "value": [ "chrome" ], "duration": 0 },
		"cookiesEnabled": { "value": false, "duration": 1 },
		"colorGamut": { "value": "rec2020", "duration": 0 },
		"invertedColors": { "duration": 0 },
		"forcedColors": { "value": false, "duration": 0 },
		"monochrome": { "value": 0, "duration": 0 },
		"contrast": { "value": 0, "duration": 0 },
		"reducedMotion": { "value": false, "duration": 0 },
		"hdr": { "value": true, "duration": 0 },
		"math": {
			"value": {
				"acos": 1.4473588658278522,
				"acosh": 709.889355822726,
				"acoshPf": 355.291251501643,
				"asin": 0.12343746096704435,
				"asinh": 0.881373587019543,
				"asinhPf": 0.8813735870195429,
				"atanh": 0.5493061443340548,
				"atanhPf": 0.5493061443340548,
				"atan": 0.4636476090008061,
				"sin": 0.8178819121159085,
				"sinh": 1.1752011936438014,
				"sinhPf": 2.534342107873324,
				"cos": -0.8390715290095377,
				"cosh": 1.5430806348152437,
				"coshPf": 1.5430806348152437,
				"tan": -1.4214488238747245,
				"tanh": 0.7615941559557649,
				"tanhPf": 0.7615941559557649,
				"exp": 2.718281828459045,
				"expm1": 1.718281828459045,
				"expm1Pf": 1.718281828459045,
				"log1p": 2.3978952727983707,
				"log1pPf": 2.3978952727983707,
				"powPI": 1.9275814160560204e-50
			},
			"duration": 1
		}
	},
	"version": "3.3.4"
}

I would appreciate any help or advice where to start and what’s the best approach of storing this data?

Hello and welcome to the Snowplow community!

I think you are right, the best approach would be attach the information as a context entity using a custom schema. Unfortunately, we do not currently have any schemas for the fingerprintjs data, so you would need to define your own. If you do so, it’d be amazing if you could share the schema to let others make use of it as well.

1 Like