Rybbit class
Main entry point for Rybbit Analytics SDK.
Provides screen view tracking, custom events, error tracking, user identification, and offline event queuing.
await Rybbit.init(host: 'https://analytics.example.com', siteId: '1');
Rybbit.instance.screenView('/home');
Rybbit.instance.event('button_click', properties: {'id': 'cta'});
- Available extensions
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state → RybbitState
-
no setter
Methods
-
clearUserId(
) → void - Clears the current user identity and removes persisted userId. Subsequent events are anonymous.
-
dispose(
) → Future< void> - Flushes pending events, cancels timers, and releases resources.
-
event(
String name, {Map< String, dynamic> ? properties}) → void -
Tracks a custom event with the given
nameand optionalproperties. -
getUserId(
) → String? -
identify(
String userId, {Map< String, dynamic> ? traits}) → void -
Associates the current device with a
userIdand optionaltraits. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeGlobalProperty(
String key) → void -
screenView(
String pathname, {String? title}) → void -
Tracks a screen view with the given
pathnameand optionaltitle. -
setGlobalProperty(
String key, dynamic value) → void -
setTraits(
Map< String, dynamic> traits) → void -
Updates
traitsfor the currently identified user without re-aliasing. -
toString(
) → String -
A string representation of this object.
inherited
-
trackAddToCart(
{required String itemId, required String itemName, double? price, int? quantity}) → void -
Available on Rybbit, provided by the RybbitGA4Events extension
-
trackAddToWishlist(
{required String itemId, required String itemName, double? price}) → void -
Available on Rybbit, provided by the RybbitGA4Events extension
-
trackBeginCheckout(
{double? value, String? currency, int? itemsCount}) → void -
Available on Rybbit, provided by the RybbitGA4Events extension
-
trackClickCta(
{String? button, String? location}) → void -
Available on Rybbit, provided by the RybbitGA4Events extension
-
trackCommentSubmit(
{String? pageId, String? pageTitle}) → void -
Available on Rybbit, provided by the RybbitGA4Events extension
-
trackContactFormSubmit(
{String? formId, String? formName}) → void -
Available on Rybbit, provided by the RybbitGA4Events extension
-
trackError(
Object error, StackTrace? stackTrace, {Map< String, dynamic> ? context}) → void -
Tracks an error with optional
stackTraceandcontextmetadata. -
trackFileDownload(
{required String fileName, String? fileExtension}) → void -
Available on Rybbit, provided by the RybbitGA4Events extension
-
trackGenerateLead(
{String? source, double? value}) → void -
Available on Rybbit, provided by the RybbitGA4Events extension
-
trackLogin(
{String? method}) → void -
Available on Rybbit, provided by the RybbitGA4Events extension
-
trackLogout(
) → void -
Available on Rybbit, provided by the RybbitGA4Events extension
-
trackNewsletterSubscribe(
{String? source}) → void -
Available on Rybbit, provided by the RybbitGA4Events extension
-
trackPurchase(
{required String transactionId, required double value, String? currency, List< Map< ? items}) → voidString, dynamic> > -
Available on Rybbit, provided by the RybbitGA4Events extension
-
trackRatingSubmit(
{required double rating, String? itemId, double? maxRating}) → void -
Available on Rybbit, provided by the RybbitGA4Events extension
-
trackRefund(
{required String transactionId, double? value, String? currency}) → void -
Available on Rybbit, provided by the RybbitGA4Events extension
-
trackRemoveFromCart(
{required String itemId, required String itemName}) → void -
Available on Rybbit, provided by the RybbitGA4Events extension
-
trackScrollDepth(
{required int percent, String? page}) → void -
Available on Rybbit, provided by the RybbitGA4Events extension
-
trackSearch(
{required String searchTerm, int? resultsCount}) → void -
Available on Rybbit, provided by the RybbitGA4Events extension
-
trackSelectPromotion(
{String? promotionId, String? promotionName}) → void -
Available on Rybbit, provided by the RybbitGA4Events extension
-
Available on Rybbit, provided by the RybbitGA4Events extension
-
trackSignUp(
{String? method}) → void -
Available on Rybbit, provided by the RybbitGA4Events extension
-
trackVideoPlay(
{String? videoId, String? videoTitle, double? duration}) → void -
Available on Rybbit, provided by the RybbitGA4Events extension
-
trackViewCart(
{int? itemsCount, double? value, String? currency}) → void -
Available on Rybbit, provided by the RybbitGA4Events extension
-
trackViewItem(
{required String itemId, required String itemName, String? category, double? price}) → void -
Available on Rybbit, provided by the RybbitGA4Events extension
-
trackViewPromotion(
{String? promotionId, String? promotionName, String? location}) → void -
Available on Rybbit, provided by the RybbitGA4Events extension
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → Rybbit
-
no setter
- isInitialized → bool
-
Whether the SDK has been initialized and is ready to track events.
no setter
Static Methods
-
init(
{required String host, required String siteId, bool debug = false, bool dryRun = false, bool autoTrackLifecycle = true, bool autoTrackErrors = true, bool autoUploadIcon = true, String? iconAssetPath, String? userAgent, Map< String, dynamic> globalProperties = const {}, int maxOfflineEvents = 1000, int offlineTtlDays = 7, int maxRetries = 3, Duration flushInterval = const Duration(seconds: 10), int flushThreshold = 20, RybbitTransport? transport, DeviceInfoProvider? deviceInfoProvider, OfflineEventStore? offlineStore}) → Future<void> -
Initializes the SDK with the given
hostURL andsiteId. -
reset(
) → Future< void> - Disposes the current instance and resets the singleton.
-
runApp(
Future< void> appRunner()) → void - Wraps the app startup with runZonedGuarded for comprehensive error capture. Catches errors that occur outside Flutter's error handlers.