Configuration Options
Superline Agent Detection provides various configuration options to customize its behavior according to your needs. This page details all available configuration options passed to theAgentDetector.init()
method.
For constructor options (metadataProvider
, eventsProvider
, eventStorage
, throttleConfig
), see the AgentDetector constructor documentation.
AgentDetectorInitOptions
The configuration object passed to theAgentDetector.init()
method.
Enables debug mode, which:
- Logs detailed information about the detection process to the console
- Includes raw extracted features in the detection result
- Provides more verbose error messages
Determines whether the detection process should start automatically after initialization.
- When
true
, event listeners are attached and data collection begins immediately - When
false
, you need to callAgentDetector.startDetection()
manually to begin collection
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.Callback function invoked when detection results are available, typically after calling
finalizeDetection()
or getCurrentDetectionResult()
.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.
The probability threshold (0-1) for classifying a session as an AI agent.
- If the calculated probability confidence is >= threshold,
isAgent
will betrue
- If the confidence is < threshold,
isAgent
will befalse
confidence
value.Configuration Examples
Best Practices
Production vs. Development
Production vs. Development
- Use
debug: true
during development to diagnose issues and inspect features. - Ensure
debug: false
in production for optimal performance and cleaner logs.
Performance Considerations
Performance Considerations
- 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.
Threshold Adjustment
Threshold Adjustment
- The default threshold (0.5) used to set
isAgent
works well for many applications. - You can adjust this threshold using the
threshold
option ininit()
. - 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.
Extractor Management
Extractor Management
- 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: