Best practices

Recommendations and usage patterns that help the performance of your web applications.

API pre-connect

API pre-connect is recommended for improved request timings. To enable it, place the preconnect directive as early as possible in your head tag:

<html>
<head>
<link rel="preconnect" href="https://cdn.fpjs.io">
<link rel="preconnect" href="https://api.fpjs.io">
... styles, js etc

Note that you always need to pre-connect to api.fpjs.io. If you're using the CDN version of the script, you also need to pre-connect to cdn.fpjs.io. If you're using the EU API, use this pre-connect URL: https://eu.api.fpjs.io

Cookie domain

This configuration option should only be used if you're running FingerprintJS Pro on multiple subdomains and want the identification process to span all of them.

When you're using FingerprintJS Pro on multiple subdomains, you need to configure the cookieDomain .

Example:

import { FP } from "@fp-pro/client"
let fp = await FP.load({
region: "us",
client: "token",
cookieDomain: "example.com"})

For instance, you're running the PRO version on foo.example.com and bar.example.com. In order for the identification cookie to work on both subdomains, configure the cookieDomain to be example.com. This will set the cookie for .example.com top-level domain and all subdomains.

Note that the cookie domain shouldn't include the preceding dot. Incorrect: cookieDomain: ".example.com" Correct: cookieDomain: "example.com"