TrackEvent class
Represents a tracking event that can be sent to Rybbit Analytics.
Contains all the data associated with an analytics event including user information, page context, and custom properties.
Constructors
-
TrackEvent({required EventType type, required String siteId, String? pathname, String? hostname, String? pageTitle, String? referrer, String? userId, String? eventName, Map<
String, dynamic> ? properties, Map<String, String> ? queryParams, String? language, int? screenWidth, int? screenHeight, String? userAgent, String? ipAddress}) -
const
-
TrackEvent.customEvent({required String siteId, required String? eventName, Map<
String, dynamic> ? properties, String? pathname, String? hostname, String? pageTitle, String? referrer, String? userId, Map<String, String> ? queryParams, String? language, int? screenWidth, int? screenHeight, String? userAgent, String? ipAddress}) - Creates a custom event for tracking user interactions.
-
TrackEvent.error({required String siteId, required String? eventName, required Map<
String, dynamic> errorProperties, String? pathname, String? hostname, String? pageTitle, String? referrer, String? userId, Map<String, String> ? queryParams, String? language, int? screenWidth, int? screenHeight, String? userAgent, String? ipAddress}) - Creates an error tracking event.
-
TrackEvent.outbound({required String siteId, required Map<
String, dynamic> outboundProperties, String? pathname, String? hostname, String? pageTitle, String? referrer, String? userId, Map<String, String> ? queryParams, String? language, int? screenWidth, int? screenHeight, String? userAgent, String? ipAddress}) - Creates an outbound link tracking event.
-
TrackEvent.pageview({required String siteId, String? pathname, String? hostname, String? pageTitle, String? referrer, String? userId, Map<
String, String> ? queryParams, String? language, int? screenWidth, int? screenHeight, String? userAgent, String? ipAddress}) - Creates a pageview tracking event.
Properties
- eventName → String?
-
Event name for custom events (required for customEvent and outbound types)
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hostname → String?
-
The domain/hostname (automatically set to app package name on mobile)
final
- ipAddress → String?
-
Custom IP address for geolocation override.
final
- language → String?
-
Language code (automatically set to device locale, e.g., 'en', 'es')
final
- pageTitle → String?
-
The title of the page/screen being tracked
final
- pathname → String?
-
The page path/route being tracked (e.g., '/home', '/products/123')
final
-
properties
→ Map<
String, dynamic> ? -
Additional event data as key-value pairs (JSON-serialized when sent)
final
-
queryParams
→ Map<
String, String> ? -
Query parameters as key-value pairs (e.g., {'utm_source': 'google', 'utm_medium': 'cpc'})
Automatically converted to query string format when sent to server
final
- referrer → String?
-
The referrer URL (previous page/screen)
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- screenHeight → int?
-
Screen height in logical pixels (automatically collected from device)
final
- screenWidth → int?
-
Screen width in logical pixels (automatically collected from device)
final
- siteId → String
-
Your Rybbit site ID (required)
final
- type → EventType
-
The type of tracking event (pageview, customEvent, outbound)
final
- userAgent → String?
-
User agent string (automatically generated with app/device info)
final
- userId → String?
-
Custom user identifier for session tracking
final
Methods
-
copyWith(
{EventType? type, String? siteId, String? pathname, String? hostname, String? pageTitle, String? referrer, String? userId, String? eventName, Map< String, dynamic> ? properties, Map<String, String> ? queryParams, String? language, int? screenWidth, int? screenHeight, String? userAgent, String? ipAddress}) → TrackEvent - Creates a copy of this event with the specified parameters overridden.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts the event to a JSON representation for sending to the server.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited