The Analytics SDK does not work in a Node.js environment.

Callable

  • analytics(app?: App):Analytics
  • Gets theAnalytics service.

    firebase.analytics() can be called with no arguments to access the defaultapp'sAnalytics service.

    The Analytics SDK does not work in a Node.js environment.

    example
    // Get the Analytics service for the default appconst defaultAnalytics = firebase.analytics();

    Parameters

    • Optional app:App

      The app to create an analytics service for.If not passed, uses the default app.

    ReturnsAnalytics

Index

Type aliases

Currency

Currency:string |number

CustomEventName

CustomEventName<T>:T extendsEventNameString ?never :T

Type parameters

  • T

EventNameString

EventNameString:"add_payment_info" |"add_shipping_info" |"add_to_cart" |"add_to_wishlist" |"begin_checkout" |"checkout_progress" |"exception" |"generate_lead" |"login" |"page_view" |"purchase" |"refund" |"remove_from_cart" |"screen_view" |"search" |"select_content" |"select_item" |"select_promotion" |"set_checkout_option" |"share" |"sign_up" |"timing_complete" |"view_cart" |"view_item" |"view_item_list" |"view_promotion" |"view_search_results"

Type for standard gtag.js event names.logEvent also accepts anycustom string and interprets it as a custom event name.

Functions

isSupported

  • isSupported():Promise<boolean>
  • An async function that returns true if current browser context supports initialization of analytics module(firebase.analytics()).

    Returns false otherwise.

    ReturnsPromise<boolean>

settings

  • settings(settingsSettingsOptions):void
  • Configures Firebase Analytics to use customgtag ordataLayer names.Intended to be used ifgtag.js script has been installed onthis page independently of Firebase Analytics, and is using non-defaultnames for either thegtag function or fordataLayer.Must be called before callingfirebase.analytics() or it won'thave any effect.

    Parameters

    Returnsvoid

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2023-09-28 UTC.