- firebase.
- analytics
The Analytics SDK does not work in a Node.js environment.
Callable
- analytics(app?: App):Analytics
Gets the
Analyticsservice.firebase.analytics()can be called with no arguments to access the defaultapp'sAnalyticsservice.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
Enumerations
Interfaces
Type aliases
Functions
Type aliases
Currency
CustomEventName
Type parameters
T
EventNameString
Type for standard gtag.js event names.logEvent also accepts anycustom string and interprets it as a custom event name.
Functions
isSupported
- is
Supported():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(settings: SettingsOptions):void
Configures Firebase Analytics to use custom
gtagordataLayernames.Intended to be used ifgtag.jsscript has been installed onthis page independently of Firebase Analytics, and is using non-defaultnames for either thegtagfunction or fordataLayer.Must be called before callingfirebase.analytics()or it won'thave any effect.Parameters
settings:SettingsOptions
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.