Obserwuj agentów AI
Crawlery AI — od GPTBot przez ClaudeBot po PerplexityBot — codziennie czytają Twoją witrynę, a większość właścicieli nigdy tego nie widzi. Tryb obserwacji to etap 1 kontroli agentów AI w SilentShield: rejestruje, które usługi AI odwiedzają które strony — niczego nie blokując i nie zmieniając zachowania Twojej witryny.
Widoczność jest przed kontrolą: dopiero gdy wiesz, kto czyta Twoje treści, możesz sensownie zdecydować, komu zezwolić, kogo ograniczyć, a kogo zablokować. Każda wizyta jest dlatego przypisywana do jednej z trzech kategorii:
- Trening
- Crawler zbiera Twoje treści, aby trenować przyszłe modele AI (np. GPTBot, ClaudeBot, CCBot).
- Wyszukiwanie AI
- Usługa czyta strony, aby odpowiadać na pytania użytkowników, i może przy tym cytować Twoją witrynę jako źródło (np. OAI-SearchBot, PerplexityBot).
- Agenci
- Bot działa w czasie rzeczywistym w imieniu konkretnej osoby — np. wyszukuje produkt lub wypełnia formularz w Twojej witrynie (np. ChatGPT-User, Claude-User).
Konfiguracja według platformy
WordPress
Wbudowany obserwator pojawi się w nadchodzącej aktualizacji wtyczki SilentShield. Do tego czasu włącz obserwację małą wtyczką must-use — jeden plik, zero konfiguracji:
Utwórz plik wp-content/mu-plugins/silentshield-observer.php o tej treści (mu-plugins ładują się automatycznie; usuń plik, aby wyłączyć):
<?php
/**
* Plugin Name: SilentShield — AI Agent Observer
* Description: Reports AI crawler visits to SilentShield (fire-and-forget;
* IP/UA are hashed server-side, GDPR). Delete this file to disable.
*
* Install: save this file as wp-content/mu-plugins/silentshield-observer.php
* (mu-plugins load automatically — no activation needed). To force it off
* without deleting: define('SILENTSHIELD_OBSERVER', false) in wp-config.php.
* An upcoming SilentShield plugin update will build this in.
*/
if (!defined('ABSPATH')) exit;
if (defined('SILENTSHIELD_OBSERVER') && !SILENTSHIELD_OBSERVER) return;
const SS_OBSERVE_URL = "https://api.silentshield.io/api/v1/agent/telemetry";
const SS_API_KEY = "YOUR_API_KEY"; // publishable site key
// For the always-fresh list, cache https://api.silentshield.io/api/v1/agent/bot-directory daily.
$ss_bots = ["GPTBot","OAI-SearchBot","ChatGPT-User","ClaudeBot","Claude-User",
"PerplexityBot","Perplexity-User","Bingbot","Applebot","Amazonbot","CCBot",
"Bytespider","meta-externalagent","Google-Agent"];
register_shutdown_function(function () use ($ss_bots) {
$ua = $_SERVER["HTTP_USER_AGENT"] ?? "";
$signed = !empty($_SERVER["HTTP_SIGNATURE"]);
$isBot = $signed;
foreach ($ss_bots as $b) { if (stripos($ua, $b) !== false) { $isBot = true; break; } }
if (!$isBot) return;
if (function_exists("fastcgi_finish_request")) { fastcgi_finish_request(); }
wp_remote_post(SS_OBSERVE_URL, [
"timeout" => 3,
"blocking" => false,
"headers" => ["Content-Type" => "application/json", "x-api-key" => SS_API_KEY],
"body" => wp_json_encode(["sightings" => [[
"ua" => $ua,
"ip" => $_SERVER["REMOTE_ADDR"] ?? "",
"path" => strtok($_SERVER["REQUEST_URI"] ?? "/", "?"),
"method" => $_SERVER["REQUEST_METHOD"] ?? "GET",
]]]),
]);
});Next.js
Samodzielny middleware — bez SDK. Obserwacja działa przez event.waitUntil(), poza ścieżką odpowiedzi, więc nigdy nie opóźnia Twoich stron:
// middleware.ts — self-contained observer, no SDK required.
// Sightings are reported via event.waitUntil(), off the response path,
// so your pages never wait. Best-effort and fail-open by design.
import { NextResponse, type NextRequest } from "next/server";
const OBSERVE_URL = "https://api.silentshield.io/api/v1/agent/telemetry";
const API_KEY = "YOUR_API_KEY"; // publishable site key
// Known AI-agent UA tokens. For the always-fresh list, fetch
// https://api.silentshield.io/api/v1/agent/bot-directory once a day and cache it.
const BOTS = ["GPTBot", "OAI-SearchBot", "ChatGPT-User", "ClaudeBot", "Claude-User",
"PerplexityBot", "Perplexity-User", "Bingbot", "Applebot", "Amazonbot", "CCBot",
"Bytespider", "meta-externalagent", "Google-Agent"];
export function middleware(req: NextRequest, event: { waitUntil(p: Promise<unknown>): void }) {
const ua = req.headers.get("user-agent") ?? "";
const signed = !!req.headers.get("signature");
if (signed || BOTS.some((b) => ua.toLowerCase().includes(b.toLowerCase()))) {
const sighting = {
ua,
path: req.nextUrl.pathname,
method: req.method,
ip: req.headers.get("x-forwarded-for")?.split(",")[0]?.trim(),
...(signed && {
signature: req.headers.get("signature"),
signature_input: req.headers.get("signature-input"),
signature_agent: req.headers.get("signature-agent"),
authority: req.nextUrl.host,
scheme: req.nextUrl.protocol.replace(":", ""),
}),
};
event.waitUntil(
fetch(OBSERVE_URL, {
method: "POST",
headers: { "Content-Type": "application/json", "x-api-key": API_KEY },
body: JSON.stringify({ sightings: [sighting] }),
}).catch(() => {}) // best-effort, fail-open
);
}
return NextResponse.next();
}Node.js (Express)
W Expressie (lub dowolnym innym serwerze Node) dodaj middleware typu fire-and-forget. Raportuje on wyłącznie żądania, których User-Agent pasuje do znanego agenta AI lub które niosą podpis Web Bot Auth — i nigdy nie blokuje odpowiedzi:
import express from "express";
const app = express();
const OBSERVE_URL = "https://api.silentshield.io/api/v1/agent/telemetry";
const API_KEY = "YOUR_API_KEY";
// Known AI-agent UA tokens. For the always-fresh list, fetch
// https://api.silentshield.io/api/v1/agent/bot-directory once a day and cache it.
const BOTS = ["GPTBot", "OAI-SearchBot", "ChatGPT-User", "ClaudeBot", "Claude-User",
"PerplexityBot", "Perplexity-User", "Bingbot", "Applebot", "Amazonbot", "CCBot",
"Bytespider", "meta-externalagent", "Google-Agent"];
// Fire-and-forget observer — never blocks the response.
app.use((req, res, next) => {
const ua = req.headers["user-agent"] || "";
const signed = !!req.headers["signature"];
if (signed || BOTS.some((b) => ua.toLowerCase().includes(b.toLowerCase()))) {
const sighting = {
ua, ip: req.ip, path: req.path, method: req.method,
...(signed && {
signature: req.headers["signature"],
signature_input: req.headers["signature-input"],
signature_agent: req.headers["signature-agent"],
authority: req.headers["host"], scheme: req.protocol,
}),
};
fetch(OBSERVE_URL, {
method: "POST",
headers: { "Content-Type": "application/json", "x-api-key": API_KEY },
body: JSON.stringify({ sightings: [sighting] }),
}).catch(() => {}); // best-effort, fail-open
}
next();
});PHP
W czystym PHP dołącz ten obserwator na samej górze swojego front controllera. Wysyła on wizytę dopiero po dostarczeniu odpowiedzi (fastcgi_finish_request), więc strona nigdy nie działa wolniej:
<?php
// Drop-in observer: include at the very top of your front controller.
// It runs after the response is sent (fastcgi_finish_request) so it never
// slows down the page. Reuses the same publishable key.
const SS_OBSERVE_URL = "https://api.silentshield.io/api/v1/agent/telemetry";
const SS_API_KEY = "YOUR_API_KEY";
// For the always-fresh list, cache https://api.silentshield.io/api/v1/agent/bot-directory daily.
$ss_bots = ["GPTBot","OAI-SearchBot","ChatGPT-User","ClaudeBot","Claude-User",
"PerplexityBot","Perplexity-User","Bingbot","Applebot","Amazonbot","CCBot",
"Bytespider","meta-externalagent","Google-Agent"];
register_shutdown_function(function () use ($ss_bots) {
$ua = $_SERVER["HTTP_USER_AGENT"] ?? "";
$signed = !empty($_SERVER["HTTP_SIGNATURE"]);
$isBot = $signed;
foreach ($ss_bots as $b) { if (stripos($ua, $b) !== false) { $isBot = true; break; } }
if (!$isBot) return;
if (function_exists("fastcgi_finish_request")) { fastcgi_finish_request(); }
$sighting = [
"ua" => $ua,
"ip" => $_SERVER["REMOTE_ADDR"] ?? "",
"path" => strtok($_SERVER["REQUEST_URI"] ?? "/", "?"),
"method" => $_SERVER["REQUEST_METHOD"] ?? "GET",
];
$ch = curl_init(SS_OBSERVE_URL);
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 3,
CURLOPT_HTTPHEADER => ["Content-Type: application/json", "x-api-key: " . SS_API_KEY],
CURLOPT_POSTFIELDS => json_encode(["sightings" => [$sighting]]),
]);
curl_exec($ch); // best-effort, fail-open
curl_close($ch);
});Go
Samodzielny obserwator w kilku linijkach — tylko biblioteka standardowa, bez SDK. Wykrycia są wysyłane w trybie fire-and-forget, więc żadne żądanie nie zyskuje opóźnienia:
// Self-contained observer — stdlib only, no SDK required.
// Reports AI-agent sightings fire-and-forget: never blocks a request,
// fail-open on any error. For the always-fresh bot list, cache
// https://api.silentshield.io/api/v1/agent/bot-directory daily.
const observeURL = "https://api.silentshield.io/api/v1/agent/telemetry"
const siteKey = "YOUR_API_KEY" // publishable — or os.Getenv("SILENTSHIELD_SITE_KEY")
var bots = []string{"GPTBot", "OAI-SearchBot", "ChatGPT-User", "ClaudeBot",
"Claude-User", "PerplexityBot", "Perplexity-User", "Bingbot", "Applebot",
"Amazonbot", "CCBot", "Bytespider", "meta-externalagent", "Google-Agent"}
func observe(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
ua, signed := r.UserAgent(), r.Header.Get("Signature") != ""
hit := signed
for _, b := range bots {
if strings.Contains(strings.ToLower(ua), strings.ToLower(b)) {
hit = true
break
}
}
if hit {
ip, _, _ := net.SplitHostPort(r.RemoteAddr)
s := map[string]any{"ua": ua, "ip": ip, "path": r.URL.Path, "method": r.Method}
if signed { // Web Bot Auth (RFC 9421) — forward for verification
s["signature"] = r.Header.Get("Signature")
s["signature_input"] = r.Header.Get("Signature-Input")
s["signature_agent"] = r.Header.Get("Signature-Agent")
s["authority"] = r.Host
}
body, _ := json.Marshal(map[string]any{"sightings": []any{s}})
go func() { // best-effort, fail-open
req, _ := http.NewRequest("POST", observeURL, bytes.NewReader(body))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("x-api-key", siteKey)
if resp, err := (&http.Client{Timeout: 3 * time.Second}).Do(req); err == nil {
resp.Body.Close()
}
}()
}
next.ServeHTTP(w, r)
})
}
// net/http: http.ListenAndServe(":8080", observe(mux))
// Gin: srv := &http.Server{Addr: ":8080", Handler: observe(r)}
// srv.ListenAndServe()Przetestuj połączenie
Nie musisz czekać na pierwszy prawdziwy crawler AI, aby potwierdzić, że Twoja integracja działa. Wyślij pusty batch — zarejestruje on heartbeat dla Twojego klucza, nie zapisując żadnych fałszywych wizyt:
curl -X POST https://api.silentshield.io/api/v1/agent/telemetry \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
--data '{"sightings":[]}'Hub agentów Twojego klucza API (Klucze API → wybierz klucz → Agent) przełączy się wtedy z „nie połączono” na „połączono — nasłuchuje”. Twój raport pozostanie pusty, dopóki nie odwiedzi Cię prawdziwy agent: SilentShield nigdy nie wymyśla danych.
RODO
Obserwacja opiera się na prawnie uzasadnionym interesie (art. 6 ust. 1 lit. f RODO). Adresy IP są hashowane po stronie serwera z solą zmienianą codziennie — surowe adresy IP nigdy nie są zapisywane. Wizyty są przechowywane przez 14 dni, a zapisywane są wyłącznie żądania znanych agentów AI: ruch zwykłych odwiedzających nigdy nie jest rejestrowany.
FAQ
Czy to spowalnia moją witrynę?
Nie. Każda integracja działa w trybie fire-and-forget: Next.js używa event.waitUntil(), PHP raportuje dopiero po wysłaniu odpowiedzi, Node i Go wysyłają w tle. A jeśli API SilentShield będzie kiedyś nieosiągalne, Twoja witryna tego nie odczuje — wszystko działa fail-open.
Co liczy się jako agent AI?
Tylko żądania pasujące do katalogu botów SilentShield ze znanymi crawlerami i agentami AI (GPTBot, ClaudeBot, PerplexityBot, …) lub niosące podpis Web Bot Auth. Zawsze aktualną listę znajdziesz pod adresem https://api.silentshield.io/api/v1/agent/bot-directory.
Dlaczego nie widzę jeszcze danych?
Crawlery AI przychodzą według własnego harmonogramu. W większości witryn pierwsze wizyty pojawiają się w ciągu 24–72 godzin; w mniejszych witrynach może to potrwać dłużej. W tym czasie heartbeat w Twoim hubie agentów potwierdza, że sama integracja działa.