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

Callable

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

    firebase.analytics() can be called with no arguments to access the default app's Analytics service.

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

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

    Parameters

    • Optional app: App

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

    Returns Analytics

Index

Type aliases

Currency

Currency: string | number

CustomEventName

CustomEventName<T>: T extends EventNameString ? 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 any custom 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.

    Returns Promise<boolean>

settings

  • settings ( settings SettingsOptions ) : void
  • Configures Firebase Analytics to use custom gtag or dataLayer names. Intended to be used if gtag.js script has been installed on this page independently of Firebase Analytics, and is using non-default names for either the gtag function or for dataLayer. Must be called before calling firebase.analytics() or it won't have any effect.

    Parameters

    Returns void