Set Up Agent Analytics

Overview

Half of your website's traffic probably comes from artificial agents, and they're becoming more intelligent every day. Track the activity of all known agents using the WordPress Plugin or API.

1. Create a New Project

Sign up and create a new project for your website if you haven't already.

2. Copy Your Access Token

3. Start Sending Visit Events

There are 2 ways to send visit events from your website to your project.

Option 1: Using the WordPress Plugin

Use this method for WordPress websites. Adding the plugin is quick and easy.

Option 2: Using the API

Use this method for server-side rendered websites. Simply make a request to the Visits endpoint every time a page view request is made to your website.

The Request

Endpoint
URL https://api.darkvisitors.com/visits
HTTP Method POST
Headers
Authorization A bearer token with your project's access token (e.g. Bearer 48d7dcbd-fc44-4b30-916b-2a5955c8ee42).
Body
request_path The URL path of your visitor's request
request_method The HTTP method of your visitor's request (e.g. GET, POST, etc.)
request_headers The HTTP headers of your visitor's request, as a key-value object

Tips

Example

This is an example for a javascript backend.

// For each page view, send a visit to Dark Visitors

fetch("https://api.darkvisitors.com/visits", {
    method: "POST",
    headers: {
        "Authorization": "Bearer " + ACCESS_TOKEN,
        "Content-Type": "application/json"
    },
    body: JSON.stringify({
        request_path: request.path,
        request_method: request.method,
        request_headers: request.headers
    })
})

... // Render and return the page's HTML response

4. Test Your Integration

If your website is correctly sending visit events to the project, you should see a new visit from the Dark Visitor agent in the project's realtime timeline.