AppAnalytics class

A wrapper class for Firebase Analytics that provides enhanced logging and user tracking

Implemented types
  • FirebasePluginPlatform

Constructors

AppAnalytics()
Constructor initializes the Firebase Analytics instance

Properties

app ↔ FirebaseApp
The FirebaseApp for this current FirebaseAnalytics instance.
getter/setter pairinherited
appInstanceId → Future<String?>
Retrieves the app instance id from the service, or null if consent has been denied.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
pluginConstants → Map
Returns any plugin constants this plugin app instance has initialized.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
webOptions → Map<String, dynamic>?
finalinherited

Methods

getSessionId() → Future<int?>
Retrieves the session id from the client. Returns null if analyticsStorageConsentGranted is false or session is expired.
inherited
initiateOnDeviceConversionMeasurementWithEmailAddress(String emailAddress) → Future<void>
Initiates on-device conversion measurement given a user email address. Requires dependency GoogleAppMeasurementOnDeviceConversion to be linked in, otherwise it is a no-op.
inherited
initiateOnDeviceConversionMeasurementWithHashedEmailAddress(String hashedEmailAddress) → Future<void>
Initiates on-device conversion measurement given a sha256-hashed, UTF8 encoded, user email address. Requires dependency GoogleAppMeasurementOnDeviceConversion to be linked in, otherwise it is a no-op.
inherited
initiateOnDeviceConversionMeasurementWithHashedPhoneNumber(String hashedPhoneNumber) → Future<void>
Initiates on-device conversion measurement given a sha256-hashed, UTF8 encoded, phone number in E.164 format. Requires dependency GoogleAppMeasurementOnDeviceConversion to be linked in, otherwise it is a no-op.
inherited
initiateOnDeviceConversionMeasurementWithPhoneNumber(String phoneNumber) → Future<void>
Initiates on-device conversion measurement given a user phone number in E.164 format. Requires dependency GoogleAppMeasurementOnDeviceConversion to be linked in, otherwise it is a no-op.
inherited
isSupported() → Future<bool>
inherited
log({required String eventName, String? category, Map<String, dynamic>? parameters}) → Future<void>
Logs an event with optional category and parameters
logAddPaymentInfo({String? coupon, String? currency, String? paymentType, double? value, List<AnalyticsEventItem>? items, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard add_payment_info event.
inherited
logAddShippingInfo({String? coupon, String? currency, double? value, String? shippingTier, List<AnalyticsEventItem>? items, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard add_shipping_info event.
inherited
logAddToCart({List<AnalyticsEventItem>? items, double? value, String? currency, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard add_to_cart event.
inherited
logAddToWishlist({List<AnalyticsEventItem>? items, double? value, String? currency, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard add_to_wishlist event.
inherited
logAdImpression({String? adPlatform, String? adSource, String? adFormat, String? adUnitName, double? value, String? currency, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard ad_impression event.
inherited
logAppOpen({AnalyticsCallOptions? callOptions, Map<String, Object>? parameters}) → Future<void>
Logs the standard app_open event.
override
logBeginCheckout({double? value, String? currency, List<AnalyticsEventItem>? items, String? coupon, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard begin_checkout event.
inherited
logCampaignDetails({required String source, required String medium, required String campaign, String? term, String? content, String? aclid, String? cp1, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard campaign_details event.
inherited
logEarnVirtualCurrency({required String virtualCurrencyName, required num value, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard earn_virtual_currency event.
inherited
logEvent({String? name, String? category, Map<String, dynamic>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs a custom Flutter Analytics event with the given name and event parameters.
override
logGenerateLead({String? currency, double? value, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard generate_lead event.
inherited
logJoinGroup({required String groupId, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard join_group event.
override
logLevelEnd({required String levelName, int? success, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard level_end event.
inherited
logLevelStart({required String levelName, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard level_start event.
inherited
logLevelUp({required int level, String? character, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard level_up event.
inherited
logLogin({String? loginMethod, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard login event.
override
logPostScore({required int score, int? level, String? character, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard post_score event.
inherited
logPurchase({String? currency, String? coupon, double? value, List<AnalyticsEventItem>? items, double? tax, double? shipping, String? transactionId, String? affiliation, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard purchase event.
inherited
logRefund({String? currency, String? coupon, double? value, double? tax, double? shipping, String? transactionId, String? affiliation, List<AnalyticsEventItem>? items, Map<String, Object>? parameters}) → Future<void>
Logs the standard refund event.
inherited
logRemoveFromCart({String? currency, double? value, List<AnalyticsEventItem>? items, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard remove_from_cart event.
inherited
logScreenView({String? screenClass, String? screenName, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard screen_view event.
override
logSearch({required String searchTerm, int? numberOfNights, int? numberOfRooms, int? numberOfPassengers, String? origin, String? destination, String? startDate, String? endDate, String? travelClass, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard search event.
inherited
logSelectContent({required String contentType, required String itemId, Map<String, Object>? parameters}) → Future<void>
Logs the standard select_content event.
inherited
logSelectItem({String? itemListId, String? itemListName, List<AnalyticsEventItem>? items, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard select_item event.
inherited
logSelectPromotion({String? creativeName, String? creativeSlot, List<AnalyticsEventItem>? items, String? locationId, String? promotionId, String? promotionName, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard select_promotion event.
inherited
logSetCheckoutOption({required int checkoutStep, required String checkoutOption, Map<String, Object>? parameters}) → Future<void>
Logs the standard set_checkout_option event. This event has been deprecated and is unsupported in updated Enhanced Ecommerce reports. See: https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics.Event.html#SET_CHECKOUT_OPTION
inherited
logShare({required String contentType, required String itemId, required String method, Map<String, Object>? parameters}) → Future<void>
Logs the standard share event.
inherited
logSignUp({required String signUpMethod, Map<String, Object>? parameters}) → Future<void>
Logs the standard sign_up event.
override
logSpendVirtualCurrency({required String itemName, required String virtualCurrencyName, required num value, Map<String, Object>? parameters}) → Future<void>
Logs the standard spend_virtual_currency event.
inherited
logTutorialBegin({Map<String, Object>? parameters}) → Future<void>
Logs the standard tutorial_begin event.
override
logTutorialComplete({Map<String, Object>? parameters}) → Future<void>
Logs the standard tutorial_complete event.
override
logUnlockAchievement({required String id, Map<String, Object>? parameters}) → Future<void>
Logs the standard unlock_achievement event with a given achievement id.
inherited
logViewCart({String? currency, double? value, List<AnalyticsEventItem>? items, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard view_cart event.
inherited
logViewItem({String? currency, double? value, List<AnalyticsEventItem>? items, Map<String, Object>? parameters}) → Future<void>
Logs the standard view_item event.
inherited
logViewItemList({List<AnalyticsEventItem>? items, String? itemListId, String? itemListName, Map<String, Object>? parameters}) → Future<void>
Logs the standard view_item_list event.
inherited
logViewPromotion({String? creativeName, String? creativeSlot, List<AnalyticsEventItem>? items, String? locationId, String? promotionId, String? promotionName, Map<String, Object>? parameters}) → Future<void>
Logs the standard view_promotion event.
inherited
logViewSearchResults({required String searchTerm, Map<String, Object>? parameters}) → Future<void>
Logs the standard view_search_results event.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
override
resetAnalyticsData() → Future<void>
Clears all analytics data for this app from the device and resets the app instance id.
inherited
setAnalyticsCollectionEnabled(bool enabled) → Future<void>
Sets whether analytics collection is enabled for this app on this device.
inherited
setConsent({bool? adStorageConsentGranted, bool? analyticsStorageConsentGranted, bool? adPersonalizationSignalsConsentGranted, bool? adUserDataConsentGranted, bool? functionalityStorageConsentGranted, bool? personalizationStorageConsentGranted, bool? securityStorageConsentGranted}) → Future<void>
Sets the applicable end user consent state. By default, no consent mode values are set.
inherited
setCurrentScreen({required String? screenName, String screenClassOverride = 'Flutter', AnalyticsCallOptions? callOptions}) → Future<void>
Sets the current screenName, which specifies the current visual context in your app.
inherited
setDefaultEventParameters(Map<String, Object?>? defaultParameters) → Future<void>
Adds parameters that will be set on every event logged from the SDK, including automatic ones.
inherited
setSessionTimeoutDuration(Duration timeout) → Future<void>
Sets the duration of inactivity that terminates the current session.
inherited
setUser({required String id, required String email}) → Future<void>
Sets user information for analytics tracking
setUserId({String? id, AnalyticsCallOptions? callOptions}) → Future<void>
Sets the user ID property.
override
setUserProperty({required String name, String? value, AnalyticsCallOptions? callOptions}) → Future<void>
Sets a user property to a given value.
override
toString() → String
A string representation of this object.
inherited

Operators

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