ElementInteractionsOptions class

Options for the autocapture elementInteractions feature.

Element interactions (click tracking) are only supported on Web, through the Browser SDK. Requires Browser SDK >= 2.10.0. Refer to docs for more details.

Flutter web requirement. DOM-based capture only sees real DOM nodes. With the default CanvasKit renderer the UI is painted to a <canvas>, so the Browser SDK can only observe elements from Flutter's accessibility semantics tree, which must be enabled globally (e.g. via SemanticsBinding.instance.ensureSemantics()). Enabling semantics app-wide has a runtime cost and known side effects, so it is not recommended unless your app already relies on semantics.

Example usage:

var analytics = Amplitude(
    Configuration(
        apiKey: 'your_api_key',
        autocapture: AutocaptureOptions(
            elementInteractions: ElementInteractionsOptions(
              cssSelectorAllowlist: ['a', 'button', 'input'],
              actionClickAllowlist: ['div'],
              dataAttributePrefix: 'data-amp-track-',
            ),
        ),
    )
);
Inheritance

Constructors

ElementInteractionsOptions({List<String>? cssSelectorAllowlist = defaultCssSelectorAllowlist, List<String>? actionClickAllowlist, String? dataAttributePrefix, List<String>? pageUrlAllowlist})
Web specific
const

Properties

actionClickAllowlist List<String>?
Web specific
final
cssSelectorAllowlist List<String>?
Web specific
final
dataAttributePrefix String?
Web specific
final
hashCode int
The hash code for this object.
no setterinherited
pageUrlAllowlist List<String>?
Web specific
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() Map<String, dynamic>
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

defaultCssSelectorAllowlist → const List<String>
Default cssSelectorAllowlist used when one is not supplied.