FirebaseAnalytics class

Firebase Analytics API.

Inheritance
  • Object
  • PlatformInterface
  • FirebasePluginPlatform
  • FirebaseAnalytics

Constructors

FirebaseAnalytics.instanceFor({required FirebaseApp app})
Returns an instance using a specified FirebaseApp.
factory

Properties

android FirebaseAnalyticsAndroid?
Namespace for analytics API available on Android only. This is deprecated in favor of FirebaseAnalytics.instance.setSessionTimeoutDuration().
final
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

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 dependency GoogleAppMeasurementOnDeviceConversion to be linked in, 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 dependency GoogleAppMeasurementOnDeviceConversion to be linked in, 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.
logEcommercePurchase({String? currency, double? value, String? transactionId, double? tax, double? shipping, String? coupon, String? location, int? numberOfNights, int? numberOfRooms, int? numberOfPassengers, String? origin, String? destination, String? startDate, String? endDate, String? travelClass}) Future<void>
Logs the standard ecommerce_purchase event. This event has been deprecated, please use purchase instead.
logEvent({required String name, Map<String, Object?>? parameters, 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.
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.
logPresentOffer({required String itemId, required String itemName, required String itemCategory, required int quantity, double? price, double? value, String? currency, String? itemLocationId}) Future<void>
Logs the standard present_offer event. This event has been deprecated, please use view_promotion instead.
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.
logPurchaseRefund({String? currency, double? value, String? transactionId}) Future<void>
Logs the standard purchase_refund event. This event has been deprecated, please use refund instead.
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.
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
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.
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.
setCurrentScreen({required String? screenName, String screenClassOverride = 'Flutter', AnalyticsCallOptions? callOptions}) Future<void>
Sets the current screenName, which specifies the current visual context in your app.
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