### NPM Installation Source: https://docs.fingerprint.com/docs/install-the-javascript-agent Initialize the agent when your application starts using NPM. This example shows how to configure the agent with your API key, custom endpoints, and region. ```APIDOC ## Initialize Agent with NPM ### Description Initialize the Fingerprint JavaScript Agent when your application starts using the NPM package. Configure the agent with your public API key, custom endpoints, and specify the data region. ### Method `Fingerprint.start()` function ### Parameters #### start() Options - **apiKey** (string) - Required - Your public API key. Example: `''` - **endpoints** (string) - Required - The custom endpoint for identification requests. Example: `'https://metrics.yourwebsite.com'` - **region** (string) - Optional - The data region (e.g., 'eu'). Example: `'eu'` ### Request Example ```javascript import Fingerprint from '@fingerprint/agent'; const fp = Fingerprint.start({ apiKey: '', endpoints: 'https://metrics.yourwebsite.com', region: 'eu', }); fp.get().then((result) => console.log(result.visitor_id)); ``` ### Response #### Success Response (visitor_id) - **visitor_id** (string) - The unique identifier for the visitor. ``` -------------------------------- ### Initialize Agent with NPM and Custom Endpoints Source: https://docs.fingerprint.com/docs/install-the-javascript-agent Use this snippet for NPM installations. It starts the agent on application startup with the provided API key, custom endpoints, and region. The visitor ID can be retrieved using the `get()` method. ```javascript import Fingerprint from '@fingerprint/agent'; // Start the agent on application start. const fp = Fingerprint.start({ apiKey: '', endpoints: 'https://metrics.yourwebsite.com', region: 'eu', }); // Get the visitor_id when you need it. fp.get().then((result) => console.log(result.visitor_id)); ``` -------------------------------- ### Install Go Dependencies Source: https://docs.fingerprint.com/docs/go-server-quickstart Installs the gorilla/mux router and the Fingerprint Go Server SDK (v8.x). Ensure Go v1.24 or later is installed. ```bash mkdir fingerprint-go-quickstart && cd fingerprint-go-quickstart go mod init fingerprint.com/go-quickstart go get github.com/gorilla/mux github.com/fingerprintjs/go-sdk/v8 ``` -------------------------------- ### HTML & CDN Installation Source: https://docs.fingerprint.com/docs/install-the-javascript-agent Initialize the agent on page load using the CDN method. This example demonstrates using custom subdomain endpoints to avoid ad blockers and includes options for region. ```APIDOC ## Initialize Agent with CDN ### Description Initialize the Fingerprint JavaScript Agent on page load using the provided script tag. This example uses custom endpoints for improved ad blocker compatibility and specifies the region. ### Method Script tag with `import()` and `Fingerprint.start()` ### Endpoint `https://metrics.yourwebsite.com/web/v4/${user.primaryBrowserToken ?? "YOUR_PUBLIC_API_KEY"}` for agent download. `https://metrics.yourwebsite.com` for identification requests. ### Parameters #### start() Options - **endpoints** (string) - Required - The custom endpoint for identification requests. Example: `'https://metrics.yourwebsite.com'` - **region** (string) - Optional - The data region (e.g., 'eu'). Example: `'eu'` ### Request Example ```html ``` ### Response #### Success Response (visitor_id) - **visitor_id** (string) - The unique identifier for the visitor. ``` -------------------------------- ### Start Go Server Source: https://docs.fingerprint.com/docs/go-server-quickstart Run this command in your terminal to start the Go server. Ensure you are in the project directory. ```bash go run main.go ``` -------------------------------- ### Install Fingerprint Vue SDK Source: https://docs.fingerprint.com/docs/nuxt-quickstart Install the Fingerprint Vue SDK using npm. This quickstart is for version 2.x. ```bash npm install @fingerprint/vue ``` -------------------------------- ### Start Fastify Server Source: https://docs.fingerprint.com/docs/node-server-quickstart Run your Node.js server using the command to start the Fastify application. ```bash node server.js ``` -------------------------------- ### Start Development Server Source: https://docs.fingerprint.com/docs/account-sharing-use-case-tutorial Start the development server to run the application locally. You can then access the mock login page at http://localhost:3000. ```bash npm run dev ``` -------------------------------- ### Start React Native Packager Source: https://docs.fingerprint.com/docs/react-native-quickstart Start the React Native development server to bundle your application. ```bash npx react-native start ``` -------------------------------- ### Start FastAPI Server Source: https://docs.fingerprint.com/docs/python-server-quickstart Command to run the FastAPI application. Ensure Python is installed and the server script is in the current directory. ```bash python server.py ``` -------------------------------- ### Create Vite React Project and Install Dependencies Source: https://docs.fingerprint.com/docs/react-quickstart Scaffold a new React application using Vite and install the necessary dependencies. This command sets up the project structure and installs the initial packages required for a React application. ```bash npm create vite@latest fingerprint-react-quickstart -- --template react cd fingerprint-react-quickstart npm install ``` -------------------------------- ### Install Dependencies and Set Up Project Source: https://docs.fingerprint.com/docs/node-server-quickstart Install Fastify and the Fingerprint Node Server SDK. Enable ES modules by setting 'type' to 'module' in package.json. ```bash mkdir fingerprint-node-quickstart && cd fingerprint-node-quickstart npm init -y npm install fastify @fingerprint/node-sdk ``` ```json { "type": "module" } ``` -------------------------------- ### Set up Python project and install dependencies Source: https://docs.fingerprint.com/docs/python-server-quickstart Create a project directory, set up a virtual environment, and define dependencies in requirements.txt. Install these dependencies using pip. ```bash mkdir fingerprint-python-starter && cd fingerprint-python-starter python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate ``` ```txt fastapi==0.115.6 uvicorn[standard]==0.32.1 python-multipart==0.0.20 pydantic==2.10.4 python-dotenv==1.0.1 fingerprint-server-sdk==9.0.0 ``` ```bash pip install -r requirements.txt ``` -------------------------------- ### Create Nuxt Project and Install Dependencies Source: https://docs.fingerprint.com/docs/nuxt-quickstart Scaffold a new Nuxt project and install necessary dependencies. This is the initial step for setting up your Nuxt application. ```bash npm create nuxt@latest fingerprint-nuxt-quickstart cd fingerprint-nuxt-quickstart npm install ``` -------------------------------- ### Install Project Dependencies Source: https://docs.fingerprint.com/docs/account-sharing-use-case-tutorial Install the required Node.js dependencies for the project. This command should be run from the root of the cloned repository. ```bash npm install ``` -------------------------------- ### Example Console Output Source: https://docs.fingerprint.com/docs/javascript-quickstart Example output shown in the browser's developer console after a successful visitor identification. ```text Visitor ID: JkLmNoPqRsTuVwXyZaBc Event ID: 1234566477745.abc1GS ``` -------------------------------- ### Start PHP Development Server Source: https://docs.fingerprint.com/docs/php-server-quickstart Starts a local PHP development server on localhost:8000. This is used for testing the backend implementation. ```bash php -S localhost:8000 ``` -------------------------------- ### Install SQLite Package Source: https://docs.fingerprint.com/docs/go-server-quickstart Install the modernc.org/sqlite package to enable SQLite database functionality for storing visitor IDs. ```bash go get modernc.org/sqlite ``` -------------------------------- ### Example HTTP Signature Headers for Agent Requests Source: https://docs.fingerprint.com/docs/bot-detection/web-bot-auth-implementation This example shows the structure of the `Signature-Agent`, `Signature-Input`, and `Signature` headers that should be attached to your agent's requests. ```bash Signature-Agent: "https://ai-agent.fyi" Signature-Input: sig1=("@authority" "signature-agent") ;created=1735689600;expires=1735693200 ;keyid="poqkLGiymh_W0uP6PZFw-dvez3QJT5SolqXBCW38r0U" ;alg="ed25519" ;nonce="3q2+7oBVKDJKNGHs1A9pYQ==" ;tag="web-bot-auth" Signature: sig1=:jdq0SqOwHdyHr9+r5jw3iYZH6aNGKijYp/EstF4RQTQdi5N5YYKrD+mCT1HA1nZDsi6nJKuHxUi/5Syp3rLWBA==: ``` -------------------------------- ### Install PHP Server SDK and Dotenv Source: https://docs.fingerprint.com/docs/php-server-quickstart Use Composer to install the Fingerprint Server SDK and the vlucas/phpdotenv package for environment variable management. ```bash mkdir fingerprint-php-quickstart && cd fingerprint-php-quickstart composer init -n --name="demo/fp-php" --type=project composer require fingerprint/server-sdk vlucas/phpdotenv ``` -------------------------------- ### Clone Starter Repository Source: https://docs.fingerprint.com/docs/account-sharing-use-case-tutorial Clone the starter repository to begin the tutorial. This repository contains the necessary project structure and mock login functionality. ```bash git clone https://github.com/fingerprintjs/use-case-tutorials.git ``` -------------------------------- ### Check CDN Installation Version (v5) Source: https://docs.fingerprint.com/docs/migrating-from-previous-versions The '/vN/' segment in the import path indicates the FingerprintJS version. This example shows v5. ```javascript const fpPromise = import('https://openfpcdn.io/fingerprintjs/v5'); ``` -------------------------------- ### Identify visitor on page load Source: https://docs.fingerprint.com/docs/identify-visitors Initialize the agent and analyze the visitor as soon as the JavaScript agent loads. This is the simplest way to get started. ```ts ``` -------------------------------- ### Basic Go Server Setup with Gorilla Mux Source: https://docs.fingerprint.com/docs/go-server-quickstart Sets up a basic HTTP server using gorilla/mux, listening on port 3000. Includes a POST route for account creation that returns a success message. ```go package main import ( "encoding/json" "log" "net/http" "github.com/gorilla/mux" ) func main() { r := mux.NewRouter() r.HandleFunc("/api/create-account", func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) json.NewEncoder(w).Encode(map[string]string{"status": "Account created!"}) }).Methods("POST") http.Handle("/", r) srv := &http.Server{ Handler: r, Addr: "localhost:3000", } log.Printf("Server is running on http://localhost:3000") log.Fatal(srv.ListenAndServe()) } ``` -------------------------------- ### Create Vite Vue Project Source: https://docs.fingerprint.com/docs/vue-quickstart Scaffold a new Vue 3 project using Vite and install dependencies. This is the initial setup for the project. ```bash npm create vite@latest fingerprint-vue-quickstart -- --template vue cd fingerprint-vue-quickstart npm install ``` -------------------------------- ### Run ASP.NET Server Source: https://docs.fingerprint.com/docs/dotnet-server-quickstart Start the ASP.NET server to test the implementation. ```bash dotnet run ``` -------------------------------- ### Install iOS Dependencies with CocoaPods Source: https://docs.fingerprint.com/docs/react-native-quickstart After installing the SDK, install the necessary iOS dependencies using CocoaPods. ```bash cd ios && pod install && cd .. ``` -------------------------------- ### Basic Fastify Server Setup Source: https://docs.fingerprint.com/docs/node-server-quickstart Create a basic Fastify server with a POST route for account creation. This route will later include Fingerprint logic to identify and potentially block suspicious users. ```javascript import Fastify from "fastify"; const app = Fastify(); app.post("/api/create-account", async (request, reply) => { // We'll add Fingerprint logic here return reply.send({ status: "Account created!" }); }); app.listen({ port: 3000 }, (err) => { if (err) throw err; console.log("Server running on http://localhost:3000"); }); ``` -------------------------------- ### Install Angular CLI Source: https://docs.fingerprint.com/docs/angular-quickstart Installs the Angular command-line interface globally. Ensure Node.js v20 or later is installed. ```bash npm install -g @angular/cli ``` -------------------------------- ### Install SQLite Package Source: https://docs.fingerprint.com/docs/node-server-quickstart Install the necessary npm package for SQLite database interaction. ```bash npm install sqlite3 ``` -------------------------------- ### Create ASP.NET Core Project and Add Fingerprint SDK Source: https://docs.fingerprint.com/docs/dotnet-server-quickstart Sets up a new ASP.NET Core web project and adds the Fingerprint .NET Server SDK package. ```bash dotnet new web -o fingerprint-dotnet-quickstart -f net9.0 cd fingerprint-dotnet-quickstart dotnet add package Fingerprint.ServerSdk ``` -------------------------------- ### JSON Example Source: https://docs.fingerprint.com/docs/webhooks-v3 This is a JSON example structure for webhooks. It shows a nested object format. ```json } } ``` ``` -------------------------------- ### JWK File Example Source: https://docs.fingerprint.com/docs/bot-detection/web-bot-auth-implementation An example of a public key represented in JSON Web Key (JWK) format. ```json {"kty":"OKP","crv":"Ed25519","x":"HzO8jiKnwNPaQZDnTzQN5_GrHwdFb8IqT-Z-HTxus44"} ``` -------------------------------- ### Initialize SQLite Database Source: https://docs.fingerprint.com/docs/python-server-quickstart Sets up the SQLite database and creates the 'accounts' table if it doesn't exist. This function should be called on application startup. ```python import sqlite3 def init_database(): conn = sqlite3.connect("database.db") cursor = conn.cursor() cursor.execute(""" CREATE TABLE IF NOT EXISTS accounts ( id INTEGER PRIMARY KEY AUTOINCREMENT, username TEXT, password TEXT, visitorId TEXT ) """) conn.commit() conn.close() init_database() ``` -------------------------------- ### Example Environment Response Source: https://docs.fingerprint.com/docs/management-api A sample JSON response when listing workspace environments. ```json { "data": [ { "id": "env_ff035a1dd7655da15295fa5fa89362a7", "name": "Default environment", "created_at": "2023-10-05T14:48:00.000Z" } ] } ``` -------------------------------- ### Install New Package Version Source: https://docs.fingerprint.com/docs/vuejs Use npm, Yarn, or PNPM to install the new version of the `@fingerprint/vue` package. ```bash npm install @fingerprint/vue ``` ```bash yarn add @fingerprint/vue ``` ```bash pnpm add @fingerprint/vue ``` -------------------------------- ### Create React Native Project Source: https://docs.fingerprint.com/docs/react-native-quickstart Use the React Native CLI to create a new project and navigate into the project directory. ```bash npx @react-native-community/cli init FingerprintQuickstart cd FingerprintQuickstart ``` -------------------------------- ### Create and run a new Vite project Source: https://docs.fingerprint.com/docs/javascript-quickstart Scaffold a new vanilla JavaScript app with Vite and install dependencies. Run the development server to view the default page. ```bash npm create vite@latest fingerprint-js-quickstart -- --template vanilla cd fingerprint-js-quickstart npm install npm run dev ``` -------------------------------- ### Configure iOS Dependencies Source: https://docs.fingerprint.com/docs/fingerprintjs-pro-react-native After installing the package, run `pod install` in the `ios` directory to link native dependencies for iOS. ```shell cd ios && pod install ``` -------------------------------- ### Install Fingerprint Agent via NPM Source: https://docs.fingerprint.com/docs Install the Fingerprint agent using NPM. This is the first step in integrating Fingerprint into your project. ```bash npm install @fingerprint/agent ``` -------------------------------- ### Install Gorilla Handlers for CORS Source: https://docs.fingerprint.com/docs/go-server-quickstart Install the gorilla/handlers module to manage Cross-Origin Resource Sharing (CORS) for local development and testing. ```bash go get github.com/gorilla/handlers ``` -------------------------------- ### Initialize SQLite Database Source: https://docs.fingerprint.com/docs/dotnet-server-quickstart Import and initialize the SQLite database connection and create the 'accounts' table if it doesn't exist. ```csharp using Microsoft.Data.Sqlite; var connectionString = "Data Source=database.db"; using var connection = new SqliteConnection(connectionString); connection.Open(); var command = connection.CreateCommand(); command.CommandText = @" CREATE TABLE IF NOT EXISTS accounts ( id INTEGER PRIMARY KEY AUTOINCREMENT, username TEXT, password TEXT, visitorId TEXT )"; command.ExecuteNonQuery(); ``` -------------------------------- ### Create Flutter Project Source: https://docs.fingerprint.com/docs/flutter-quickstart Use the Flutter CLI to create a new project and navigate into its directory. ```bash flutter create fingerprint_flutter_quickstart cd fingerprint_quickstart ``` -------------------------------- ### Install PNPM Package Source: https://docs.fingerprint.com/docs/fingerprintjs-pro-react-native Install the FingerprintJS Pro React Native package using PNPM. This is another alternative package manager. ```shell pnpm add @fingerprintjs/fingerprintjs-pro-react-native ``` -------------------------------- ### Install Yarn Package Source: https://docs.fingerprint.com/docs/fingerprintjs-pro-react-native Install the FingerprintJS Pro React Native package using Yarn. This is an alternative to NPM for package management. ```shell yarn add @fingerprintjs/fingerprintjs-pro-react-native ``` -------------------------------- ### Set up account creation form HTML Source: https://docs.fingerprint.com/docs/javascript-quickstart Add an account creation form with username and password fields to your index.html file. This serves as the basic structure for user interaction. ```html

Create an account

``` -------------------------------- ### Initialize SQLite Database Table Source: https://docs.fingerprint.com/docs/php-server-quickstart Sets up an SQLite database table to store account information, including the visitor ID. Run this script once to create the database file and table. ```php exec(" CREATE TABLE IF NOT EXISTS accounts ( id INTEGER PRIMARY KEY AUTOINCREMENT, username TEXT NOT NULL, password TEXT NOT NULL, visitorId TEXT NOT NULL )"); echo "Database ready."; ``` -------------------------------- ### Configure Fingerprint API Keys Source: https://docs.fingerprint.com/docs/account-sharing-use-case-tutorial Set up your Fingerprint public and secret API keys in the .env file. Replace 'your-public-key' and 'your-secret-key' with your actual keys obtained from the Fingerprint dashboard. ```bash FP_PUBLIC_API_KEY=your-public-key FP_SECRET_API_KEY=your-secret-key ```