analytics
The Firebase Analytics service interface.
This module is available for the default app only.
Example
Get the Analytics service for the default app:
const defaultAppAnalytics = firebase.analytics();
Properties
Methods
- getAppInstanceId
- logAddPaymentInfo
- logAddShippingInfo
- logAddToCart
- logAddToWishlist
- logAppOpen
- logBeginCheckout
- logCampaignDetails
- logEarnVirtualCurrency
- logEvent
- logGenerateLead
- logJoinGroup
- logLevelEnd
- logLevelStart
- logLevelUp
- logLogin
- logPostScore
- logPurchase
- logRefund
- logRemoveFromCart
- logScreenView
- logSearch
- logSelectContent
- logSelectItem
- logSelectPromotion
- logSetCheckoutOption
- logShare
- logSignUp
- logSpendVirtualCurrency
- logTutorialBegin
- logTutorialComplete
- logUnlockAchievement
- logViewCart
- logViewItem
- logViewItemList
- logViewPromotion
- logViewSearchResults
- resetAnalyticsData
- setAnalyticsCollectionEnabled
- setDefaultEventParameters
- setSessionTimeoutDuration
- setUserId
- setUserProperties
- setUserProperty
getAppInstanceId
</>Retrieve the app instance id of the application.
getAppInstanceId(): Promise<string | null>;
logAddPaymentInfo
</>Add Payment Info event. This event signifies that a user has submitted their payment information to your app.
logAddPaymentInfo(params: AddPaymentInfoEventParameters): Promise<void>;
logAddShippingInfo
</>E-Commerce Add Shipping Info event. This event signifies that a user has submitted their shipping information. Use this event to identify popular gift items in your app.
logAddShippingInfo(params: AddShippingInfoParameters): Promise<void>;
logAddToCart
</>E-Commerce Add To Cart event.
logAddToCart(params: AddToCartEventParameters): Promise<void>;
logAddToWishlist
</>E-Commerce Add To Wishlist event. This event signifies that an item was added to a wishlist. Use this event to identify popular gift items in your app.
logAddToWishlist(params: AddToWishlistEventParameters): Promise<void>;
logAppOpen
</>App Open event. By logging this event when an App is moved to the foreground, developers can understand how often users leave and return during the course of a Session. Although Sessions are automatically reported, this event can provide further clarification around the continuous engagement of app-users.
logAppOpen(): Promise<void>;
logBeginCheckout
</>E-Commerce Begin Checkout event. This event signifies that a user has begun the process of checking out.
logBeginCheckout(params?: BeginCheckoutEventParameters): Promise<void>;
logCampaignDetails
</>Log this event to supply the referral details of a re-engagement campaign.
logCampaignDetails(params: CampaignDetailsEventParameters): Promise<void>;
logEarnVirtualCurrency
</>Earn Virtual Currency event. This event tracks the awarding of virtual currency in your app. Log this along with
logSpendVirtualCurrency
to better understand your virtual economy.
logEarnVirtualCurrency(params: EarnVirtualCurrencyEventParameters): Promise<void>;
logEvent
</>Log a custom event with optional params. Note that there are various limits that applied to event parameters (total parameter count, etc), but analytics applies the limits during cloud processing, the errors will not be seen as Promise rejections when you call logEvent. While integrating this API in your app you are strongly encouraged to enable DebugView - any errors in your events will show up in the firebase web console with links to relevant documentation
logEvent(name: string, params?: undefined | { [key: string]: any }): Promise<void>;
logGenerateLead
</>Generate Lead event. Log this event when a lead has been generated in the app to understand the efficacy of your install and re-engagement campaigns.
logGenerateLead(params?: GenerateLeadEventParameters): Promise<void>;
logJoinGroup
</>Join Group event. Log this event when a user joins a group such as a guild, team or family. Use this event to analyze how popular certain groups or social features are in your app
logJoinGroup(params: JoinGroupEventParameters): Promise<void>;
logLevelUp
</>Level Up event. This event signifies that a player has leveled up in your gaming app. It can help you gauge the level distribution of your userbase and help you identify certain levels that are difficult to pass.
logLevelUp(params: LevelUpEventParameters): Promise<void>;
logLogin
</>Login event. Apps with a login feature can report this event to signify that a user has logged in.
logLogin(params: LoginEventParameters): Promise<void>;
logPostScore
</>Post Score event. Log this event when the user posts a score in your gaming app. This event can help you understand how users are actually performing in your game and it can help you correlate high scores with certain audiences or behaviors.
logPostScore(params: PostScoreEventParameters): Promise<void>;
logPurchase
</>E-Commerce Purchase event. This event signifies that an item(s) was purchased by a user. Note: This is different from the in-app purchase event, which is reported automatically for Google Play-based apps.
logPurchase(params: PurchaseEventParameters): Promise<void>;
logRefund
</>E-Commerce Refund event. This event signifies that a refund was issued.
logRefund(params: RefundEventParameters): Promise<void>;
logRemoveFromCart
</>Remove from cart event.
logRemoveFromCart(params: RemoveFromCartEventParameters): Promise<void>;
logScreenView
</>Sets or clears the screen name and class the user is currently viewing
logScreenView(params: ScreenViewParameters): Promise<void>;
logSearch
</>Search event. Apps that support search features can use this event to contextualize search operations by supplying the appropriate, corresponding parameters. This event can help you identify the most popular content in your app.
logSearch(params: SearchEventParameters): Promise<void>;
logSelectContent
</>Select Content event. This general purpose event signifies that a user has selected some content of a certain type in an app. The content can be any object in your app. This event can help you identify popular content and categories of content in your app.
logSelectContent(params: SelectContentEventParameters): Promise<void>;
logSelectItem
</>Select Item event. This event signifies that an item was selected by a user from a list. Use the appropriate parameters to contextualize the event. Use this event to discover the most popular items selected.
logSelectItem(params: SelectItemEventParameters): Promise<void>;
logSelectPromotion
</>Select promotion event. This event signifies that a user has selected a promotion offer. Use the appropriate parameters to contextualize the event, such as the item(s) for which the promotion applies.
logSelectPromotion(params: SelectPromotionEventParameters): Promise<void>;
logShare
</>Share event. Apps with social features can log the Share event to identify the most viral content.
logShare(params: ShareEventParameters): Promise<void>;
logSignUp
</>Sign Up event. This event indicates that a user has signed up for an account in your app. The parameter signifies the method by which the user signed up. Use this event to understand the different behaviors between logged in and logged out users.
logSignUp(params: SignUpEventParameters): Promise<void>;
logSpendVirtualCurrency
</>Spend Virtual Currency event. This event tracks the sale of virtual goods in your app and can help you identify which virtual goods are the most popular objects of purchase.
logSpendVirtualCurrency(params: SpendVirtualCurrencyEventParameters): Promise<void>;
logTutorialBegin
</>Tutorial Begin event. This event signifies the start of the on-boarding process in your app.
Use this in a funnel with analytics#logTutorialComplete
to understand how many users
complete this process and move on to the full app experience.
logTutorialBegin(): Promise<void>;
logTutorialComplete
</>Tutorial End event. Use this event to signify the user's completion of your app's on-boarding process.
Add this to a funnel with analytics#logTutorialBegin
to understand how many users
complete this process and move on to the full app experience.
logTutorialComplete(): Promise<void>;
logUnlockAchievement
</>Unlock Achievement event. Log this event when the user has unlocked an achievement in your game. Since achievements generally represent the breadth of a gaming experience, this event can help you understand how many users are experiencing all that your game has to offer.
logUnlockAchievement(params: UnlockAchievementEventParameters): Promise<void>;
logViewCart
</>E-commerce View Cart event. This event signifies that a user has viewed their cart. Use this to analyze your purchase funnel.
logViewCart(params: ViewCartEventParameters): Promise<void>;
logViewItem
</>View Item event. This event signifies that some content was shown to the user. This content may be a product, a screen or just a simple image or text. Use the appropriate parameters to contextualize the event. Use this event to discover the most popular items viewed in your app.
logViewItem(params: ViewItemEventParameters): Promise<void>;
logViewItemList
</>View Item List event. Log this event when the user has been presented with a list of items of a certain category.
logViewItemList(params: ViewItemListEventParameters): Promise<void>;
logViewPromotion
</>View Promotion event. This event signifies that a promotion was shown to a user.
logViewPromotion(params: ViewPromotionEventParameters): Promise<void>;
logViewSearchResults
</>View Search Results event. Log this event when the user has been presented with the results of a search.
logViewSearchResults(params: ViewSearchResultsParameters): Promise<void>;
resetAnalyticsData
</>Clears all analytics data for this instance from the device and resets the app instance ID.
resetAnalyticsData(): Promise<void>;
setAnalyticsCollectionEnabled
</>If true, allows the device to collect analytical data and send it to Firebase. Useful for GDPR.
setAnalyticsCollectionEnabled(enabled: boolean): Promise<void>;
setDefaultEventParameters
</>Adds parameters that will be set on every event logged from the SDK, including automatic ones.
setDefaultEventParameters(params?: undefined | { [key: string]: any }): Promise<void>;
setSessionTimeoutDuration
</>Sets the duration of inactivity that terminates the current session.
setSessionTimeoutDuration(milliseconds?: undefined | number): Promise<void>;