> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fingerprint.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> Fingerprint JavaScript agent v3.6.0 or later is required.

Fingerprint Cloudflare Proxy Integration is responsible for proxying identification and agent-download requests between your website and Fingerprint through Cloudflare. Your website does not strictly need to be behind Cloudflare to use this proxy integration, although that is optimal for ease of setup and maximum accuracy benefits.

<img src="https://mintcdn.com/fingerprint/JTUbc3rQcwtp3hbV/images/1a44a4c-Clouflare_integration.png?fit=max&auto=format&n=JTUbc3rQcwtp3hbV&q=85&s=6d9d9eb0615d969ed92d439045bfe6d3" alt="Cloudflare Proxy Integration" width="3840" height="1692" data-path="images/1a44a4c-Clouflare_integration.png" />

The integration consists of three fundamental components:

* Fingerprint infrastructure.
* Cloudflare worker — created and managed by Fingerprint, but running in your Cloudflare account.
* Fingerprint JavaScript agent installed on your website.

Fingerprint creates a [Cloudflare Worker](https://workers.cloudflare.com/) that's available on a specific path on your site. The rest of your site is not affected.

Cloudflare worker code is 100% open-source and available [on GitHub](https://github.com/fingerprintjs/fingerprintjs-pro-cloudflare-worker). Once the Fingerprint JavaScript agent is configured on your site correctly, the worker is responsible for delivering the latest fingerprinting client-side logic as well as proxying identification requests and responses between your site and Fingerprint's APIs.

## The benefits of using the Cloudflare Integration

* Significant increase in accuracy in browsers with strict privacy features such as Safari or Firefox.
* Cookies are now recognized as “first-party.” This means they can live longer in the browser and extend the lifetime of visitor IDs.
* Ad blockers will not block our Fingerprint JavaScript agent from loading. Attempts to connect to an external URL will be stopped by most ad blockers while attempts to connect to the same site URL will be allowed.
* Ad blockers will not block our identification requests since they are sent to the specific path or subdomain that belongs to the same site.
* Insight and control over the identification requests that can be combined with other Cloudflare features like WAF or Analytics.
* With the Cloudflare Integration, you can manage unlimited subdomains and paths and provide Fingerprint services to all your customers at any scale while benefiting from all the 1st-party integration improvements.
* Cookie security: Cloudflare integration drops all the cookies sent from the origin website. The worker code is open-source so this behavior can be transparently verified and audited.
* Easy to meet compliance and auditing requirements.

## Setup

The Cloudflare configuration guide on the Fingerprint [dashboard](https://dashboard.fingerprint.com/) will help you set everything up step by step. You can start the guide by going to **SDKs & integrations**.

<Warning>
  **Prerequisites**

  * Only users with the **Admin** or **Owner** roles can launch the Cloudflare configuration guide in the dashboard.
  * Cloudflare Integration makes use of the Cloudflare Workers [Custom Routes](https://developers.cloudflare.com/workers/platform/triggers/routes) feature. Therefore, your site needs to be [added to Cloudflare](https://developers.cloudflare.com/fundamentals/get-started/setup/add-site/) and needs to be [proxied](https://developers.cloudflare.com/dns/manage-dns-records/reference/proxied-dns-records/) (not DNS-only) through Cloudflare. If you can only add your domain to Cloudflare without proxying (DNS-only), take a look at [Alternative worker subdomain setup (for DNS-only domains)](#alternative-worker-subdomain-setup-for-dns-only-domains).
</Warning>

### Step 1: Follow the Cloudflare configuration wizard

1. Navigate to **SDKs & integrations**, then select **Cloudflare**.

<img src="https://mintcdn.com/fingerprint/JTUbc3rQcwtp3hbV/images/2405f7a18b78dfc5956ae51c1e55b8a6a158ebded8bc225b8131b2de0775b3f8-CleanShot_2024-11-07_at_12.28.302x.png?fit=max&auto=format&n=JTUbc3rQcwtp3hbV&q=85&s=6d30127d9b78936021811e225c031e34" alt="SDKs & integrations page - Cloudflare Integration" width="3166" height="1650" data-path="images/2405f7a18b78dfc5956ae51c1e55b8a6a158ebded8bc225b8131b2de0775b3f8-CleanShot_2024-11-07_at_12.28.302x.png" />

2. After opening the Cloudflare configuration guide, click **Connect**.

<img src="https://mintcdn.com/fingerprint/JTUbc3rQcwtp3hbV/images/22b50512977759a0e0e6b6539040c677fcf3c0a8827a1563aff8aa49d8a3d44c-image.png?fit=max&auto=format&n=JTUbc3rQcwtp3hbV&q=85&s=fce50dc0969e34d61eaabdc680397389" alt="Cloudflare configuration wizard - Connect" width="2482" height="1246" data-path="images/22b50512977759a0e0e6b6539040c677fcf3c0a8827a1563aff8aa49d8a3d44c-image.png" />

3. Optionally, you can [scope the integration to a specific environment](/docs/v3/multiple-environments#proxy-integrations-and-proxy-secrets).

   * By default, the integration works for all environments in your workspace.
   * If you choose to scope the integration to a specific environment, the integration will only proxy identification requests made with public API keys from that environment.

4. Add information about your Cloudflare account.

<img src="https://mintcdn.com/fingerprint/TYcq-XM0A17l1fxD/images/6a1d5c502f9e9e95fdf38d3f6c3addba197d6e359440a6a16a31630b800632ea-image.png?fit=max&auto=format&n=TYcq-XM0A17l1fxD&q=85&s=5f2eed247a7c20079bc80a3b5dbd2f6c" alt="Cloudflare configuration wizard - Add information" width="946" height="705" data-path="images/6a1d5c502f9e9e95fdf38d3f6c3addba197d6e359440a6a16a31630b800632ea-image.png" />

<br />

| Name                  | Example                                  | Short description                                                                                                           |
| :-------------------- | :--------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------- |
| Cloudflare Account ID | 88e2a7348d589a61edd0918e57fb136f         | The Account ID obtained from the [Cloudflare Dashboard](https://dash.cloudflare.com/).                                      |
| Cloudflare API Token  | YQSnnxWAQiiEh9qM58wZNnyQS7FUdoqGIUAbrh7T | API Token generated from the Cloudflare's [User Profile 'API Tokens' page](https://dash.cloudflare.com/profile/api-tokens). |

#### Cloudflare Account ID

The *Account ID* is required to deploy workers. Go to [Cloudflare Workers](https://dash.cloudflare.com/?to=/:account/workers) and copy the *Account ID*.

#### Cloudflare API Token

The *API Token* is required to deploy workers. Go to the [*API Tokens* page](https://dash.cloudflare.com/profile/api-tokens), select [*Create Custom Token*](https://dash.cloudflare.com/profile/api-tokens?permissionGroupKeys=%5B%7B"key"%3A"workers_routes"%2C"type"%3A"edit"%7D%2C%7B"key"%3A"workers_scripts"%2C"type"%3A"edit"%7D%5D\&name=fingerprint.com), and follow the steps below.

* Type `fingerprint.com` in the name field.
* *Add Account* > *Workers Scripts* > *Edit* permission.
* *Add Zone* > *Workers Routes* > *Edit* permission.
* Select the account in the *Account Resources*.
* *Select Specific zone* > *yourwebsite* in the *Zone Resources*.
* *Add IP Filtering* > *3.23.16.20*.
* Do not set any TTL.

<img src="https://mintcdn.com/fingerprint/TYcq-XM0A17l1fxD/images/b9e906d-api_token.png?fit=max&auto=format&n=TYcq-XM0A17l1fxD&q=85&s=7e595dede496e2f76af872fd30f35f2b" alt="API Token Creation Form" width="899" height="802" data-path="images/b9e906d-api_token.png" />

In the next step, see the summary and click **Create Token**.

<img src="https://mintcdn.com/fingerprint/JTUbc3rQcwtp3hbV/images/0098c26-api_token_summary.png?fit=max&auto=format&n=JTUbc3rQcwtp3hbV&q=85&s=b65813777d8dfae0cd0d9e0728f464c9" alt="API Token Summary" width="717" height="434" data-path="images/0098c26-api_token_summary.png" />

<Note>
  **API Token Safety**

  When creating an API Token, it is considered best practice to grant it as few privileges as possible. In the example above, the API Token has permissions to only manage workers in your account. Fingerprint will use your API Token for managing the Fingerprint Cloudflare Worker and nothing else.

  Fingerprint always encrypts customer data, including API tokens and configuration items. This guarantees that the data we get from our customers is securely transmitted and stored. The Client IP Address Filtering functionality adds an additional layer of security. Safelisting our public Cloudflare service IP address ensures that the API Token can only be used by Fingerprint services and no one else.
</Note>

4. After entering *Account ID* and *API Token*, proceed to the next step.

   <img src="https://mintcdn.com/fingerprint/q7SuknsArT5Y4WhX/images/d683ae2d67d615b5fee125bf91a9dfdfb437d27ef8c3613a68a97be9140b51b1-image.png?fit=max&auto=format&n=q7SuknsArT5Y4WhX&q=85&s=d13b19ca37ebaf58c2c6b140f6a9c24c" alt="Cloudflare configuration wizard - Select domain" width="1962" height="1422" data-path="images/d683ae2d67d615b5fee125bf91a9dfdfb437d27ef8c3613a68a97be9140b51b1-image.png" />

5. Select the same domain you had created the API Token for before from the dropdown menu. If you don't see the domain you wish to use, please contact our [support team](https://fingerprint.com/support).

   <img src="https://mintcdn.com/fingerprint/TYcq-XM0A17l1fxD/images/989cdf8d6c282100fef0d8ddd6767b747a990c1ca8082568280d87a6ec5a2b01-image.png?fit=max&auto=format&n=TYcq-XM0A17l1fxD&q=85&s=6d3c40e03ac1f34436f199ca94d294b0" alt="Cloudflare configuration wizard - Select domain" width="1982" height="1458" data-path="images/989cdf8d6c282100fef0d8ddd6767b747a990c1ca8082568280d87a6ec5a2b01-image.png" />

6. Confirm to start the deployment process. This process may take several minutes.

   <img src="https://mintcdn.com/fingerprint/TYcq-XM0A17l1fxD/images/9b4dd34924d403cf5b19f390f2b3b87d9c1bf363b8f27fa4250d71afb8fbd4f0-image.png?fit=max&auto=format&n=TYcq-XM0A17l1fxD&q=85&s=f47440eb13626a23857fe9c6e7e3032c" alt="Cloudflare configuration wizard - Confirm" width="2194" height="1532" data-path="images/9b4dd34924d403cf5b19f390f2b3b87d9c1bf363b8f27fa4250d71afb8fbd4f0-image.png" />

When you provide the integration wizard with the information above, we will create a Cloudflare Worker in your Cloudflare account. Cloudflare Worker will be named *fingerprint-pro-cloudflare-worker-your-website-com-random-id*, and you will be able to see it in [Cloudflare Workers Dashboard](https://dash.cloudflare.com/?to=/:account/workers/overview) once it is deployed.

<Warning>
  **Do not disrupt worker authentication or updates**

  The integration wizard creates a proxy secret in your Fingerprint dashboard and passes it to your Cloudflare worker's environment variables.

  * Don't delete the proxy secret in either place. Proxied identification requests without a valid proxy secret will result in an authentication error and not receive identification results.

  We are responsible for updating your Cloudflare Worker to ensure visitor identification on your website runs smoothly and keeps up with new browser releases and fingerprinting evasion techniques. Outdated worker configuration can lead to lower accuracy or break visitor identification completely. Don't make any changes that would prevent us from updating your worker:

  * Don't reduce the API Token permissions or revoke it.
  * Don't change the name of the worker (worker names are used as IDs).
  * Don't change the original worker route and configuration.
</Warning>

### Step 2: Configure your JavaScript agent

Once the worker is deployed, you need to configure your client-side application accordingly. In this step, you can choose from a variety of frameworks, platforms, and approaches. You can always come back to **SDKs & integrations** to find code snippets for different frameworks that reflect your Cloudflare configuration setup.

<img src="https://mintcdn.com/fingerprint/q7SuknsArT5Y4WhX/images/e963aabe55173aaa9f907734290a9e1756604ad5de66073fd9696df042fe3558-image.png?fit=max&auto=format&n=q7SuknsArT5Y4WhX&q=85&s=8a94bb36f21827f0fa833021b5691e15" alt="Cloudflare configuration wizard - Configure your JavaScript agent" width="1972" height="1618" data-path="images/e963aabe55173aaa9f907734290a9e1756604ad5de66073fd9696df042fe3558-image.png" />

#### JavaScript agent configuration example

<CodeGroup>
  ```javascript NPM package theme={"theme":"github-dark-dimmed"}
  // The same pattern applies to React SDK, Vue SDK, etc.
  import * as FingerprintJS from "@fingerprintjs/fingerprintjs-pro";

  const fpPromise = FingerprintJS.load({
    apiKey: PUBLIC_API_KEY,
    scriptUrlPattern: [
      "https://yourwebsite.com/AGENT_SCRIPT_DOWNLOAD_PATH?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",
      FingerprintJS.defaultScriptUrlPattern, // Fallback to default CDN in case of error
    ],
    endpoint: [
      "https://yourwebsite.com/GET_RESULT_PATH?region=us",
      FingerprintJS.defaultEndpoint, // Fallback to default endpoint in case of error
    ],
  });

  fpPromise.then((fp) => fp.get()).then((result) => console.log(result.visitorId));
  ```

  ```javascript CDN installation theme={"theme":"github-dark-dimmed"}
  const fpPromise = import(
    "https://yourwebsite.com/AGENT_SCRIPT_DOWNLOAD_PATH?apiKey=PUBLIC_API_KEY"
  ).then((FingerprintJS) =>
    FingerprintJS.load({
      endpoint: [
        "https://yourwebsite.com/GET_RESULT_PATH?region=us",
        FingerprintJS.defaultEndpoint, // Fallback to default endpoint in case of error
      ],
    }),
  );

  fpPromise.then((fp) => fp.get()).then((result) => console.log(result.visitorId));
  ```
</CodeGroup>

<Note>
  **URL nuances**

  * Note that the import `url` for the CDN installation method and `scriptUrlPattern` used by NPM packages are similar but different and **cannot be used interchangeably**.
  * Pay close attention to the query parameters:
    * **Include the region** in the `endpoint` parameters using the following format: `?region=REGION`. The `REGION` value needs to be replaced with the [region](/docs/v3/regions) of your application.
    * **Use this exact query string in the `scriptUrlPattern`:** `?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>`. The `apiKey` `version` and `loaderVersion` parameters will be replaced by the values in the NPM package automatically. Do not alter them manually.
</Note>

### Using Multiple Worker Routes

Cloudflare Integration uses Cloudflare Workers, which supports [multiple routes](https://developers.cloudflare.com/workers/platform/triggers/routes/). You can add more routes if you need to but don't change the original worker route and configuration created by Fingerprint.

## Monitoring and troubleshooting the integration

You can go to **Dashboard** > [**SDKs & integrations**](https://dashboard.fingerprint.com/integrations) > **Cloudflare** to see the integration status, usage statistics, and configuration. You can monitor:

* If the integration is up to date.
* How many identification requests are coming through the integration (and how many are not).
* The error rate of proxied identification requests (caused by a missing or incorrect proxy secret).

The information on the status page is cached so allow a few minutes for the latest data points to be reflected.

<img src="https://mintcdn.com/fingerprint/q7SuknsArT5Y4WhX/images/da812b35a7227e3875aa3d5288f2eb378ef84c5f8a466958c9fe1811d1db4708-image.png?fit=max&auto=format&n=q7SuknsArT5Y4WhX&q=85&s=c1e1da2ea341c3206cef8a33f499d90a" alt="Cloudflare integration status" width="1281" height="863" data-path="images/da812b35a7227e3875aa3d5288f2eb378ef84c5f8a466958c9fe1811d1db4708-image.png" />

The Cloudflare integration has limited visibility into your Cloudflare environment. If you run into issues, please verify that one of your existing Firewall rules, rate limiting rules, or other Cloudflare restrictions is not disrupting the Fingerprint worker and its path. Get in touch with our [support team](https://fingerprint.com/support/) if necessary.

### Updating the Cloudflare token

If you accidentally delete the Cloudflare API token you provided us with, you can update it inside the Fingerprint dashboard.

* Go to [**SDKs & integrations**](https://dashboard.fingerprint.com/integrations) > **Cloudflare** and click **Edit API token**.

<img src="https://mintcdn.com/fingerprint/TYcq-XM0A17l1fxD/images/6f3fe22e9c06eaea8ab38722781a0d094247ec206e3b996e093ee9c74527bdc9-CleanShot_2024-11-07_at_12.33.402x.png?fit=max&auto=format&n=TYcq-XM0A17l1fxD&q=85&s=d5f7cb3e8d23bf252af09feb7d3ea6b4" alt="Cloudflare configuration wizard - Updating the Cloudflare token" width="2548" height="904" data-path="images/6f3fe22e9c06eaea8ab38722781a0d094247ec206e3b996e093ee9c74527bdc9-CleanShot_2024-11-07_at_12.33.402x.png" />

### Deleting the integration

If something goes irreversibly wrong with your integration or Cloudflare worker configuration, you can delete everything and create a new integration from scratch.

1. Make sure your Fingerprint JavaScript agent is not using the integration URLs you are about to delete.
2. Go to [**SDKs & integrations**](https://dashboard.fingerprint.com/integrations) > **Cloudflare** and click **Delete integration** at the bottom of the page.

This will delete the Cloudflare worker and all associated records.

## Alternative worker subdomain setup (for DNS-only domains)

The Cloudflare configuration guide above assumes your website is added to Cloudflare and [proxied through Cloudflare](https://developers.cloudflare.com/dns/manage-dns-records/reference/proxied-dns-records/) (not DNS-only). If your website proxy status is DNS-only, the worker will not be accessible on the generated path and the provided code snippets will not work.

<img src="https://mintcdn.com/fingerprint/JTUbc3rQcwtp3hbV/images/1b59897-image.png?fit=max&auto=format&n=JTUbc3rQcwtp3hbV&q=85&s=b15841a55b42e3abfb87aa416c02da03" alt="Cloudflare integration status" width="2254" height="262" data-path="images/1b59897-image.png" />

If you can't proxy your primary domain through Cloudflare, you can work around this issue by hosting the Fingerprint worker on a subdomain. This still requires that your website is [added to Cloudflare](https://developers.cloudflare.com/fundamentals/setup/manage-domains/add-site/) without proxying (in DNS-only mode).

1. Follow the installation steps above to deploy the proxy integration worker in your Cloudflare account.
2. Go to your [Cloudflare dashboard](https://dash.cloudflare.com/).
3. In the left-hand navigation, click **Workers & Pages**.
4. Click on your Fingerprint Cloudflare worker. It will be named like **fingerprint-pro-cloudflare-worker-yourwebsite-com**.
5. At the top, click **Settings**, then look for **Domains & Routes**.
6. Click **+ Add** and select **Custom domain**.
7. Enter a subdomain like `metrics.yourwebsite.com` and click **Add domain** to confirm. Avoid terms commonly blocked by ad-blockers like `fingerprint`, `fpjs`, `track`, etc.

<img src="https://mintcdn.com/fingerprint/TYcq-XM0A17l1fxD/images/9ad83f6136af6a03867949e3f6d706cac7526dac8ad7ebe62d4d17ae3aefd7f4-cloudflare_add_custom_domain.png?fit=max&auto=format&n=TYcq-XM0A17l1fxD&q=85&s=c4f29869b8299893c871ecdd2acf48d9" alt="Cloudflare add custom domain" width="1084" height="383" data-path="images/9ad83f6136af6a03867949e3f6d706cac7526dac8ad7ebe62d4d17ae3aefd7f4-cloudflare_add_custom_domain.png" />

Your new subdomain will be proxied through Cloudflare, even though your primary domain is not:

<img src="https://mintcdn.com/fingerprint/q7SuknsArT5Y4WhX/images/d3feb8c-cloudflare-alternative-setup-dns.png?fit=max&auto=format&n=q7SuknsArT5Y4WhX&q=85&s=3031b793b363b66f5361f48e3e1fbfa1" alt="Cloudflare alternative setup DNS" width="2616" height="772" data-path="images/d3feb8c-cloudflare-alternative-setup-dns.png" />

Your Fingerprint worker is now accessible on your chosen subdomain. You need to adjust the code snippets provided on the
[**SDKs & integrations**](https://dashboard.fingerprint.com/integrations) page accordingly. For example:
`endpoint: https://yourwebsite.com/VWmFUKL1dfIjc8gg/SjM9xGRJcN3lZycu` becomes
`endpoint: https://metrics.yourwebsite.com/VWmFUKL1dfIjc8gg/SjM9xGRJcN3lZycu`.
