FirebaseAnalytics class

Firebase Analytics API.

Inheritance
  • Object
  • FirebasePlugin
  • FirebaseAnalytics

Constructors

FirebaseAnalytics.instanceFor({required FirebaseApp app, Map<String, dynamic>? webOptions})
Returns an instance using a specified FirebaseApp.
factory

Properties

app ↔ FirebaseApp
The FirebaseApp for this current FirebaseAnalytics instance.
getter/setter pair
appInstanceId → Future<String?>
Retrieves the app instance id from the service, or null if consent has been denied.
no setter
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>?
final

Methods

getSessionId() → Future<int?>
Retrieves the session id from the client. Returns null if analyticsStorageConsentGranted is false or session is expired.
initiateOnDeviceConversionMeasurementWithEmailAddress(String emailAddress) → Future<void>
Initiates on-device conversion measurement given a user email address. Requires Firebase iOS SDK 12.0.0+ with FirebaseAnalytics dependency, otherwise it is a no-op.
initiateOnDeviceConversionMeasurementWithHashedEmailAddress(String hashedEmailAddress) → Future<void>
Initiates on-device conversion measurement given a sha256-hashed, UTF8 encoded, user email address. Requires Firebase iOS SDK 12.0.0+ with FirebaseAnalytics dependency, otherwise it is a no-op.
initiateOnDeviceConversionMeasurementWithHashedPhoneNumber(String hashedPhoneNumber) → Future<void>
Initiates on-device conversion measurement given a sha256-hashed, UTF8 encoded, phone number in E.164 format. Requires Firebase iOS SDK 12.0.0+ with FirebaseAnalytics dependency, otherwise it is a no-op.
initiateOnDeviceConversionMeasurementWithPhoneNumber(String phoneNumber) → Future<void>
Initiates on-device conversion measurement given a user phone number in E.164 format. Requires Firebase iOS SDK 12.0.0+ with FirebaseAnalytics dependency, otherwise it is a no-op.
isSupported() → Future<bool>
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.
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.
logAddToCart({List<AnalyticsEventItem>? items, double? value, String? currency, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard add_to_cart event.
logAddToWishlist({List<AnalyticsEventItem>? items, double? value, String? currency, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard add_to_wishlist event.
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.
logAppOpen({AnalyticsCallOptions? callOptions, Map<String, Object>? parameters}) → Future<void>
Logs the standard app_open event.
logBeginCheckout({double? value, String? currency, List<AnalyticsEventItem>? items, String? coupon, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard begin_checkout event.
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.
logEarnVirtualCurrency({required String virtualCurrencyName, required num value, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard earn_virtual_currency event.
logEvent({required String name, Map<String, Object>? parameters, List<AnalyticsEventItem>? items, AnalyticsCallOptions? callOptions}) → Future<void>
Logs a custom Flutter Analytics event with the given name and event parameters.
logGenerateLead({String? currency, double? value, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard generate_lead event.
logInAppPurchase({String? currency, bool? freeTrial, double? price, bool? priceIsDiscounted, String? productID, String? productName, int? quantity, bool? subscription, num? value}) → Future<void>
Logs the standard in_app_purchase event.
logJoinGroup({required String groupId, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard join_group event.
logLevelEnd({required String levelName, int? success, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard level_end event.
logLevelStart({required String levelName, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard level_start event.
logLevelUp({required int level, String? character, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard level_up event.
logLogin({String? loginMethod, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard login event.
logPostScore({required int score, int? level, String? character, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard post_score event.
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.
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.
logRemoveFromCart({String? currency, double? value, List<AnalyticsEventItem>? items, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard remove_from_cart event.
logScreenView({String? screenClass, String? screenName, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard screen_view event.
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.
logSelectContent({required String contentType, required String itemId, Map<String, Object>? parameters}) → Future<void>
Logs the standard select_content event.
logSelectItem({String? itemListId, String? itemListName, List<AnalyticsEventItem>? items, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard select_item event.
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.
logShare({required String contentType, required String itemId, required String method, Map<String, Object>? parameters}) → Future<void>
Logs the standard share event.
logSignUp({required String signUpMethod, Map<String, Object>? parameters}) → Future<void>
Logs the standard sign_up event.
logSpendVirtualCurrency({required String itemName, required String virtualCurrencyName, required num value, Map<String, Object>? parameters}) → Future<void>
Logs the standard spend_virtual_currency event.
logTransaction(String transactionId) → Future<void>
Logs verified in-app purchase events in Google Analytics for Firebase after a purchase is successful.
logTutorialBegin({Map<String, Object>? parameters}) → Future<void>
Logs the standard tutorial_begin event.
logTutorialComplete({Map<String, Object>? parameters}) → Future<void>
Logs the standard tutorial_complete event.
logUnlockAchievement({required String id, Map<String, Object>? parameters}) → Future<void>
Logs the standard unlock_achievement event with a given achievement id.
logViewCart({String? currency, double? value, List<AnalyticsEventItem>? items, Map<String, Object>? parameters, AnalyticsCallOptions? callOptions}) → Future<void>
Logs the standard view_cart event.
logViewItem({String? currency, double? value, List<AnalyticsEventItem>? items, Map<String, Object>? parameters}) → Future<void>
Logs the standard view_item event.
logViewItemList({List<AnalyticsEventItem>? items, String? itemListId, String? itemListName, Map<String, Object>? parameters}) → Future<void>
Logs the standard view_item_list event.
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.
logViewSearchResults({required String searchTerm, Map<String, Object>? parameters}) → Future<void>
Logs the standard view_search_results event.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resetAnalyticsData() → Future<void>
Clears all analytics data for this app from the device and resets the app instance id.
setAnalyticsCollectionEnabled(bool enabled) → Future<void>
Sets whether analytics collection is enabled for this app on this device.
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.
setDefaultEventParameters(Map<String, Object?>? defaultParameters) → Future<void>
Adds parameters that will be set on every event logged from the SDK, including automatic ones.
setSessionTimeoutDuration(Duration timeout) → Future<void>
Sets the duration of inactivity that terminates the current session.
setUserId({String? id, AnalyticsCallOptions? callOptions}) → Future<void>
Sets the user ID property.
setUserProperty({required String name, required String? value, AnalyticsCallOptions? callOptions}) → Future<void>
Sets a user property to a given value.
toString() → String
A string representation of this object.
inherited

Operators

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

Static Properties

instance → FirebaseAnalytics
Returns an instance using the default FirebaseApp.
no setter