Superline Agent Detection is designed to be easy to integrate into any web application. This quick start guide will help you get up and running in minutes.
<!-- Add the script with defer attribute --><script src="https://cdn.jsdelivr.net/npm/@superline-ai/agent-detection/dist/umd/index.umd.js" defer></script>
import AgentDetector from '@superline-ai/agent-detection';// Initialize the detectorAgentDetector.init({ debug: false, autoStart: true, threshold: 0.6 // Optional: Set custom detection threshold (default: 0.5)});// Later, when you want to check if the session is from an agentconst result = await AgentDetector.finalizeDetection();console.log('Is agent:', result.isAgent, 'Confidence:', result.confidence);
Copy
import AgentDetector from '@superline-ai/agent-detection';// Initialize the detectorAgentDetector.init({ debug: false, autoStart: true, threshold: 0.6 // Optional: Set custom detection threshold (default: 0.5)});// Later, when you want to check if the session is from an agentconst result = await AgentDetector.finalizeDetection();console.log('Is agent:', result.isAgent, 'Confidence:', result.confidence);
Copy
<script defer> document.addEventListener('DOMContentLoaded', function() { // Initialize it AgentDetector.init({ debug: false, autoStart: true, threshold: 0.6 // Optional: Set custom detection threshold (default: 0.5) }); // Later, check if the session is from an agent AgentDetector.finalizeDetection() .then(result => { console.log('Is agent:', result.isAgent, 'Confidence:', result.confidence); }); });</script>
You can easily integrate Superline Agent Detection with your analytics platform to differentiate between humans and AI agents in your metrics.
Copy
// After getting the detection resultconst result = await AgentDetector.finalizeDetection();// Example with Google Analytics 4gtag('set', 'user_properties', { is_agent: result.isAgent, agent_confidence: result.confidence});// Example with Mixpanelmixpanel.people.set({ 'Is Agent': result.isAgent, 'Agent Confidence': result.confidence});