Installare il Widget
Aggiunga SilentShield al Suo sito web con sole due righe di codice. Il Widget rileva automaticamente i moduli e inizia a proteggerli.
Integrazione di base
Aggiunga questo frammento di codice prima del tag di chiusura </body> del Suo sito web:
<script src="https://api.silentshield.io/client.js?key=YOUR_API_KEY" defer></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
SilentShield.init({ apiKey: 'YOUR_API_KEY' });
});
</script>Cosa succede automaticamente
- Il Widget rileva tutti i moduli sulla pagina
- L'analisi del comportamento si avvia in background (invisibile agli utenti)
- Un CAPTCHA appare solo quando viene rilevato un comportamento sospetto
- Un Nonce di verifica viene iniettato nei moduli prima dell'invio
Verifica lato server (consigliata)
Dopo l'invio di un modulo, verifichi il Nonce sul Suo server per confermare che l'invio provenga da un essere umano.
POST https://api.silentshield.io/api/v1/captcha/verify-nonce
X-Api-Key: YOUR_API_KEY
PHPphp
<?php
$nonce = $_POST['ss_nonce'] ?? '';
$ch = curl_init('https://api.silentshield.io/api/v1/captcha/verify-nonce');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'X-Api-Key: ' . $apiKey,
],
CURLOPT_POSTFIELDS => json_encode(['nonce' => $nonce]),
CURLOPT_RETURNTRANSFER => true,
]);
$result = json_decode(curl_exec($ch), true);
curl_close($ch);
if ($result['verdict'] === 'bot') {
http_response_code(403);
die('Bot detected');
}Node.jsjavascript
const response = await fetch('https://api.silentshield.io/api/v1/captcha/verify-nonce', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Api-Key': process.env.SILENTSHIELD_API_KEY,
},
body: JSON.stringify({ nonce: req.body.ss_nonce }),
});
const data = await response.json();
if (data.verdict === 'bot') {
return res.status(403).json({ error: 'Bot detected' });
}Test
Aggiunga ?silentshield-debug al Suo URL per attivare l'overlay di debug. Mostra in tempo reale il punteggio del comportamento attuale, il verdetto e le funzionalità attive.