Caution
This project is no longer maintained and should not be used in production. Please refer to Fastly Proxy Integration documentation if you are interested in the up-to-date project.
Fingerprint is a device intelligence platform offering 99.5% accurate visitor identification.
This custom Fastly Proxy Integration example is responsible for proxying identification and agent-download requests between your application and Fingerprint through your Fastly infrastructure. This example uses Fastly Compute services.
-
Integration example in Beta: Please report any issues to our support team.
-
Limited to specific Enterprise customers: At this point, this custom integration example is accessible and exclusively supported for specific customers on the Enterprise Plan. Other customers are encouraged to use Custom subdomain setup or Cloudflare Proxy Integration.
-
Manual updates occasionally required: The underlying data contract in the identification logic can change to keep up with browser updates. Using the Fastly Proxy Integration might require occasional manual updates on your side. Ignoring these updates will lead to lower accuracy or service disruption.
This guide assumes you already have a Fastly account and a Fingerprint account.
- Go to the Fingerprint dashboard and select your application.
- Navigate to App settings > API keys.
- Click Create Proxy Key.
- Name the key
Fastly Integration
. - Click Create API Key.
You will use the secret to authenticate requests from your proxy integration to the Fingerprint API.
- Create a Fastly API Token in your Fastly dashboard.
- Make sure the token has a
global
scope. - Name your token
Fingerprint
. - Note the value of your token somewhere. You will use it in the following step to deploy the proxy integration to your Fastly account.
-
Install the Fastly CLI on your computer following Fastly documentation.
-
Configure the CLI profile with the token you created in the previous step:
fastly profile create
-
Run
git clone [email protected]:fingerprintjs/fingerprint-pro-fastly-proxy-integration-example.git
-
Run
cd fingerprint-pro-fastly-proxy-integration-example
-
Run
yarn install
-
Inside the
fastly.toml
file, add your email to theauthors
field.- authors = [] + authors = ["[email protected]"]
- Run
yarn deploy
. - Type
y
to create a new service. - You can keep
fingerprint-pro-fastly-proxy-integration
as the service name. - Skip through the rest of the prompts by pressing
Enter
.
Fastly will create the service under one of its domains, {host}.edgecompute.app
. We will change it later.
At this point, the service is still returning an error like {"error":"something went wrong"}
as it requires more configuration.
Add two backends, fpcdn.io
and api.fpjs.io
.
- Go to your Fingerprint service in the Fastly dashboard and select the latest editable version. If you don't have an editable version, click Edit Configuration and Clone version N (active) to edit to create an editable version of the service.
- In the left menu, click Origins.
- Click Create Host, type
fpcdn.io
and click Add. - Click Edit on the previously created host.
- Change its name to
fpcdn
. - Scroll down and set Override host to
fpcdn.io
. - Click Update to save changes.
- Change its name to
- Click Create Host, type
api.fpjs.io
and click Add. - Click Edit on the previously created host.
- Change its name to
fpjs
. - Scroll down and set Override host to
api.fpjs.io
. - Click Update to save changes.
- Change its name to
Warning
If you are not using the Global/US Fingerprint region, instead of api.fpjs.io
use eu.api.fpjs.io
for the EU region or ap.api.fpjs.io
for AP region.
Provide the proxy secret and your chosen resource paths to the service.
- In Fastly, go to the Resources tab.
- Click Create a config store.
- Name the config store exactly
Fingerprint
(the store name is hard-coded in the service implementation) and click Add. - Click Link to services and select
fingerprint-pro-fastly-proxy-integration
. - Click Next, select the current (draft) version of your service, and click Link only.
- Click Finish.
- Find your new config store and click Key-value pairs to add the following values:
- set
AGENT_SCRIPT_DOWNLOAD_PATH
to your chosen agent download path. It should be something random to avoid ad blockers, for example,463n7-d0wnl04d
. - set
GET_RESULT_PATH
to your chosen identification result path. It should be something random to avoid ad blockers, for example,1d3n71f1c4710n-r35ul7
. - set
PROXY_SECRET
to the value of your Fingerprint proxy secret you created in Step 1.
- set
We recommend using a subdomain of the website you want to use Fingerprint on. Do not use fingerprint
, fpjs
, and other fingerprint-related terms in the subdomain to avoid ad blockers. Use something random or generic, for example: metrics.yourwebsite.com
.
- Navigate to the Fastly dashboard > Secure > TLS Management.
- Click Secure domain or Secure another domain.
- Select Use certificates Fastly obtains for you.
- Enter your domain and click Add.
- Configure Certification Authority and TLS configuration according to your needs and click Submit.
- Follow the instructions on the screen to validate the ownership of the domain.
- When the validation is done, find your domain in the list of Domains.
- Click View details and find the CNAME record associated with the domain in the form of
{letter}.sni.global.fastly.net
. - Using your DNS provider, create a CNAME record for your subdomain with this value (
CNAME metrics.yourwebsite.com -> {letter}.sni.global.fastly.net
)
- Go to your Fingerprint service in the Fastly dashboard and select the latest editable version.
- In the left menu, click Domains.
- Click Create Domain and type the domain you've previously created.
- Click Add to save changes.
- Go to the Fingerprint service in Fastly dashboard and select the latest editable version.
- Click Activate (if you see Validating instead, wait for it to complete).
Wait a couple of minutes for the activation. You can go to metrics.yourwebsite.com/status
to verify that your integration is running.
Configure the Fingerprint client agent to make requests to your integration instead of the default Fingerprint APIs.
- Set
endpoint
to the path of yourGET_RESULT_PATH
endpoint, for example,https://metrics.yourwebsite.com/1d3n71f1c4710n-r35ul7
. - For websites and web-based mobile applications using one of our SDKs, set the
scriptUrlPattern
to the path of yourAGENT_SCRIPT_DOWNLOAD_PATH
endpoint, for example,https://metrics.yourwebsite.com/463n7-d0wnl04d?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>
.- Keep the query parameters as displayed here, including
<
and>
.
- Keep the query parameters as displayed here, including
The CDN installation method pattern looks slightly different: https://metrics.yourwebsite.com/463n7-d0wnl04d?apiKey=PUBLIC_API_KEY
, see the full code examples below.
The same principle applies to our client SDKs.
import * as FingerprintJS from "@fingerprintjs/fingerprintjs-pro";
const fpPromise = FingerprintJS.load({
apiKey: PUBLIC_API_KEY,
scriptUrlPattern: [
"https://metrics.yourwebsite.com/AGENT_SCRIPT_DOWNLOAD_PATH?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",
FingerprintJS.defaultScriptUrlPattern, // Fallback to default CDN in case of error
],
endpoint: [
"https://metrics.yourwebsite.com/GET_RESULT_PATH",
FingerprintJS.defaultEndpoint, // Fallback to default endpoint in case of error
],
});
const url = "https://metrics.yourwebsite.com/AGENT_SCRIPT_DOWNLOAD_PATH?apiKey=PUBLIC_API_KEY";
const fpPromise = import(url).then((FingerprintJS) =>
FingerprintJS.load({
endpoint: [
"https://metrics.yourwebsite.com/GET_RESULT_PATH",
FingerprintJS.defaultEndpoint, // Fallback to default endpoint in case of error
],
}),
);
Please reach out to our Customer Success team if run into any issues with the integration.
This project is licensed under the MIT license.