← Back

Send Visit Events From Your Fastly Website

Step 1: Create a Logging Endpoint

(
    if(req.http.Fastly-Orig-Host, req.http.Fastly-Orig-Host, req.http.Host) == "YOUR_DOMAIN" ||
    if(req.http.Fastly-Orig-Host, req.http.Fastly-Orig-Host, req.http.Host) == "www.YOUR_DOMAIN"
) &&
fastly.ff.visits_this_service == 0
{
    "time_start_ms":"%{time.start.msec}V",
    "time_end_ms":"%{time.end.msec}V",
    "time_elapsed_ms":"%{time.elapsed.msec}V",
    "client_ip": "%{req.http.Fastly-Client-IP}V",
    "host": "%{if(req.http.Fastly-Orig-Host, req.http.Fastly-Orig-Host, req.http.Host)}V",
    "url": "%{json.escape(req.url)}V",
    "original_url": "%{json.escape(req.http.X-Original-URL)}V",
    "request_method": "%{json.escape(req.method)}V",
    "request_referer": "%{json.escape(req.http.referer)}V",
    "request_user_agent": "%{json.escape(req.http.User-Agent)}V",
    "request_signature": "%{json.escape(req.http.Signature)}V",
    "request_signature_agent": "%{json.escape(req.http.Signature-Agent)}V",
    "request_signature_input": "%{json.escape(req.http.Signature-Input)}V",
    "response_status": %{resp.status}V,
    "response_content_type": "%{json.escape(resp.http.Content-Type)}V"
}
https://api.knownagents.com/logs/fastly
text/plain
Authorization
Bearer YOUR_ACCESS_TOKEN

Step 2: Test Your Integration

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

Extend Your Integration

Track MCP Calls and Agentic Commerce Interactions

If you also want to send MCP calls and agentic commerce interactions, send those events through the REST API.