Superline Agent Detection provides various configuration options to customize its behavior according to your needs. This page details all available configuration options passed to the AgentDetector.init() method.
Array of custom feature extractor classes to use instead of the default ones. Defaults to DEFAULT_EXTRACTORS.
Each extractor class must extend the FeatureExtractor base class (or similar) and be provided as a constructor.
Copy
import AgentDetector from '@superline-ai/agent-detection';import CustomExtractor from './my-custom-extractor';AgentDetector.init({ extractorClasses: [CustomExtractor]});
Overrides the throttle configuration provided in the constructor for this instance.
Used to control the rate at which high-frequency events (like mouse movements) are processed.
Use debug: true during development to diagnose issues and inspect features.
Ensure debug: false in production for optimal performance and cleaner logs.
Using default extractors and throttle settings provides a good balance.
If performance issues arise on low-end devices, consider increasing throttleConfig values (e.g., mouseMoveThrottleMs) to reduce processing load.
Providing only necessary custom extractors via extractorClasses can also improve performance if default ones are not needed.
The default threshold (0.5) used to set isAgent works well for many applications.
You can adjust this threshold using the threshold option in init().
Increase threshold (e.g., 0.7) if false positives (humans marked as agents) are problematic.
Decrease threshold (e.g., 0.3) if false negatives (agents marked as humans) are problematic.
Consider your application’s specific needs and tolerance for misclassification when adjusting.
Always analyze the raw confidence in your analytics for the most nuanced understanding.
By default, the library uses a set of core extractors (DEFAULT_EXTRACTORS).
Providing extractorClasses replaces the default set entirely. If you want to add to the defaults, you need to explicitly include the defaults in your array:
Copy
import { DEFAULT_EXTRACTORS } from '@superline-ai/agent-detection';import MyCustomExtractor from './my-custom-extractor';AgentDetector.init({ extractorClasses: [...DEFAULT_EXTRACTORS, MyCustomExtractor]});