Connect Your Node.js Website to Agent & LLM Analytics
Overview
Use the NPM package to connect your website. Please contact us if you need help.
Step 1: Copy Your Access Token
- Navigate to the Projects page
- Select your project
- Click Settings
- Copy your access token
Step 2: Install the NPM Package
Download the package from NPM using the command line.
npm install @darkvisitors/sdk
Step 3: Initialize the Client
In your code, create an instance of DarkVisitors
with your access token.
import { DarkVisitors } from "@darkvisitors/sdk"
const darkVisitors = new DarkVisitors(YOUR_ACCESS_TOKEN)
Step 4: Start Tracking Visits
Call trackVisit
for each incoming request in the endpoints where you serve your pages. If you can, add this in middleware to track incoming requests to all pages from a single place. See an example on NPM.
darkVisitors.trackVisit(request)
Step 5: Test Your Integration
- Navigate to the Projects page
- Select your project
- Click Settings
- Click Send a Test Visit
- Click Realtime
If your website is correctly connected, you should see visits from the Dark Visitor agent in the realtime timeline within a few seconds.