Connect Your Backend to Agent & LLM Analytics

Overview

Use the REST API to connect your website with a backend written in any programming language. Please contact us if you need help.

Step 1: Copy Your Access Token

Step 2: Start Tracking Visits

In the endpoints where you serve your pages, make an HTTP request to the REST API for each incoming pageview request. If you can, add this in middleware to track incoming requests to all pages from a single place.

URL
URL https://api.darkvisitors.com/visits
HTTP Method POST
Headers
Authorization A bearer token with your project's access token (e.g. Bearer 48d7-fc44-4b30-916b-2a59).
Content-Type This needs to be set to application/json
Body
request_path The URL path of the incoming pageview request
request_method The HTTP method of the incoming pageview request (e.g. GET, POST, etc.)
request_headers The HTTP headers of the incoming pageview request, as a key-value object.

Example

curl -X POST https://api.darkvisitors.com/visits \\
-H "Authorization: Bearer \${ACCESS_TOKEN}" \\
-H "Content-Type: application/json" \\
-d '{
"request_path": "'"\${request.path}"'",
"request_method": "'"\${request.method}"'",
"request_headers": "'"\${request.headers}"'"
}'

Tips

Step 3: Test Your Integration

If your website is correctly connected, you should see visits from the Dark Visitor agent in the realtime timeline within a few seconds.