JavaScript
π Quick Startβ
Get your credentials from the Developer Console and add this single script tag to your HTML:
<script
async
src="https://api.trustedaccounts.org/js-sdk.js"
onload="new TrustedTraffic({publishableKey:'YOUR_PUBLISHABLE_KEY'}).init()">
</script>
π― Bot Detection & Traffic Analyticsβ
The TrustedTraffic SDK automatically detects bots and provides real-time analytics:
<script
async
src="https://api.trustedaccounts.org/js-sdk.js"
onload="new TrustedTraffic({publishableKey:'YOUR_PUBLISHABLE_KEY'}).init()">
</script>
<script>
// Get traffic analytics data
const traffic = trustedTraffic.getAnalytics();
console.log('Bot/Human ratio:', traffic.botRatio);
console.log('Traffic quality score:', traffic.qualityScore);
</script>
π Browser Fingerprintingβ
Get detailed browser fingerprint data for enhanced security:
<script
async
src="https://api.trustedaccounts.org/js-sdk.js"
onload="new TrustedTraffic({publishableKey:'YOUR_PUBLISHABLE_KEY'}).init()">
</script>
<script>
// Get browser fingerprint
const fingerprint = trustedTraffic.getFingerprint();
console.log('Browser fingerprint:', fingerprint);
// Send fingerprint to your server for analysis
fetch('/api/analyze-fingerprint', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ fingerprint })
});
</script>
π§ Email Validationβ
Validate email addresses in real-time (server-side only):
const validateEmail = async (email, secretKey) => {
try {
const response = await fetch('https://api.trustedaccounts.org/email/validate', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${secretKey}`
},
body: JSON.stringify({
email: email,
options: {
validateSMTP: true, // Real-time SMTP validation
validateMX: true, // Check MX records
checkDisposable: true, // Detect disposable emails
checkTypo: true // Detect typos and suggest corrections
}
})
});
const result = await response.json();
return result;
} catch (error) {
console.error('Email validation failed:', error);
return { valid: false, reason: 'Validation service unavailable' };
}
};
// Usage (server-side only)
validateEmail('user@example.com', 'YOUR_SECRET_KEY').then(result => {
if (result.valid) {
console.log('Email is valid:', result);
} else {
console.log('Email validation failed:', result.reason);
if (result.suggestions) {
console.log('Suggestions:', result.suggestions);
}
}
});
π± Phone Verificationβ
Verify phone numbers with SMS:
const verifyPhone = async (phoneNumber) => {
try {
const response = await fetch('https://api.trustedaccounts.org/phone/YOUR_PUBLISHABLE_KEY/verify', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
phone: phoneNumber,
country: 'US' // Optional country code
})
});
const result = await response.json();
return result;
} catch (error) {
console.error('Phone verification failed:', error);
return { success: false, error: 'Verification service unavailable' };
}
};
// Usage
verifyPhone('+1234567890').then(result => {
if (result.success) {
console.log('SMS sent! Verification code:', result.code);
} else {
console.log('Phone verification failed:', result.error);
}
});
π‘οΈ taCAPTCHA Integrationβ
Add privacy-friendly CAPTCHA to your forms:
<!-- Include taCAPTCHA CSS and JavaScript -->
<link rel="stylesheet" href="https://api.trustedaccounts.org/static/trusted-accounts-captcha.css">
<script async defer src="https://api.trustedaccounts.org/static/trusted-accounts-captcha.js" type="module"></script>
<form method="post" action="/submit">
<input type="text" name="username" placeholder="Username" required>
<input type="email" name="email" placeholder="Email" required>
<!-- Add taCAPTCHA to your form -->
<ta-captcha name="captcha"></ta-captcha>
<button type="submit">Submit</button>
</form>
Server-side verification (Node.js/Express):
app.post('/submit', async (req, res) => {
const { captcha } = req.body;
// Verify the CAPTCHA token
const verifyData = await fetch('https://api.trustedaccounts.org/v1/verify/signature', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ payload: captcha })
}).then(res => res.json());
if (verifyData.verified) {
// CAPTCHA is valid, process the form
res.json({ success: true, message: 'Form submitted successfully' });
} else {
res.status(400).json({ error: 'CAPTCHA verification failed' });
}
});
π That's it!β
You now have:
- β Real-time bot detection
- β Traffic analytics dashboard
- β Browser fingerprinting
- β Email validation
- β Phone verification
- β Privacy-friendly CAPTCHA
- β Zero backend changes required
Visit the Developer Console to see your analytics and manage your integrations!