← Back
Send Visit Events From Your Fastly Website
Step 1: Create a Logging Endpoint
- Select your website's CDN service in your Fastly dashboard
- Click Edit configuration and clone the active version if needed
- In the sidebar, click Logging
- Create an endpoint for HTTPS
- Click attach a condition at the very top
- For the name, choose something like
Domain Matches - Enter the following for Apply if...:
req.http.host == "YOUR_DOMAIN" && fastly.ff.visits_this_service == 0
- Swap in your domain (e.g.
example.com) where it saysYOUR_DOMAIN - Click Save and apply to this to return to the endpoint setup form
- For the endpoint Name, choose something like
Known Agents Analytics - Enter the following for Log format:
{
"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": "%{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"
}
- Enter this URL:
https://api.knownagents.com/logs/fastly
- Expand the Advanced Options section
- For Content type, enter:
text/plain
- For Custom header name, enter:
Authorization
- For Custom header value, enter:
Bearer YOUR_ACCESS_TOKEN
- Navigate to the Known Agents Projects page and open your project
- Copy your access token from the Settings page
- Back in Fastly, swap in your access token where it says
YOUR_ACCESS_TOKEN - For JSON log entry format, select Newline delimited
- For Compression, select Gzip
- Click Create, then Activate to deploy the new version
Step 2: 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 a test agent in the realtime timeline within a few seconds.
MCP Calls and Agentic Commerce Interactions
This integration only sends pageview events. If you also want to send MCP calls and agentic commerce interactions, send those events through the REST API. For example, you can use the Cloudflare Worker alongside this integration. Otherwise, use the Cloudflare Worker guide as an example of how to send only MCP calls and agentic commerce interactions without duplicating pageview events.