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

## Functions

| Function | Description |
|---|---|
| **function(app, ...)** |   |
| [getAnalytics(app)](https://firebase.google.com/docs/reference/js/analytics#getanalytics_cf608e1) | Returns an [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) instance for the given app. |
| [initializeAnalytics(app, options)](https://firebase.google.com/docs/reference/js/analytics#initializeanalytics_a68c1d7) | Returns an [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) instance for the given app. |
| **function(analyticsInstance, ...)** |   |
| [getGoogleAnalyticsClientId(analyticsInstance)](https://firebase.google.com/docs/reference/js/analytics#getgoogleanalyticsclientid_b0a3b5a) | Retrieves a unique Google Analytics identifier for the web client. See [client_id](https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id). |
| [logEvent(analyticsInstance, eventName, eventParams, options)](https://firebase.google.com/docs/reference/js/analytics#logevent_d5f1743) | Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events). |
| [logEvent(analyticsInstance, eventName, eventParams, options)](https://firebase.google.com/docs/reference/js/analytics#logevent_507c89b) | Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events). |
| [logEvent(analyticsInstance, eventName, eventParams, options)](https://firebase.google.com/docs/reference/js/analytics#logevent_918c505) | Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.See [Track Screenviews](https://firebase.google.com/docs/analytics/screenviews). |
| [logEvent(analyticsInstance, eventName, eventParams, options)](https://firebase.google.com/docs/reference/js/analytics#logevent_97ff7c6) | Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events). |
| [logEvent(analyticsInstance, eventName, eventParams, options)](https://firebase.google.com/docs/reference/js/analytics#logevent_1f89527) | Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events). |
| [logEvent(analyticsInstance, eventName, eventParams, options)](https://firebase.google.com/docs/reference/js/analytics#logevent_5dd5dd2) | Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events). |
| [logEvent(analyticsInstance, eventName, eventParams, options)](https://firebase.google.com/docs/reference/js/analytics#logevent_77bad34) | Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events). |
| [logEvent(analyticsInstance, eventName, eventParams, options)](https://firebase.google.com/docs/reference/js/analytics#logevent_560b592) | Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events). |
| [logEvent(analyticsInstance, eventName, eventParams, options)](https://firebase.google.com/docs/reference/js/analytics#logevent_0f60635) | Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events). |
| [logEvent(analyticsInstance, eventName, eventParams, options)](https://firebase.google.com/docs/reference/js/analytics#logevent_bf98d4d) | Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events). |
| [logEvent(analyticsInstance, eventName, eventParams, options)](https://firebase.google.com/docs/reference/js/analytics#logevent_88130b6) | Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events). |
| [logEvent(analyticsInstance, eventName, eventParams, options)](https://firebase.google.com/docs/reference/js/analytics#logevent_feb40db) | Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events). |
| [logEvent(analyticsInstance, eventName, eventParams, options)](https://firebase.google.com/docs/reference/js/analytics#logevent_cfbc3bb) | Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events). |
| [logEvent(analyticsInstance, eventName, eventParams, options)](https://firebase.google.com/docs/reference/js/analytics#logevent_f0c3c2c) | Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events). |
| [logEvent(analyticsInstance, eventName, eventParams, options)](https://firebase.google.com/docs/reference/js/analytics#logevent_a155179) | Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events). |
| [logEvent(analyticsInstance, eventName, eventParams, options)](https://firebase.google.com/docs/reference/js/analytics#logevent_c4de9a4) | Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events). |
| [logEvent(analyticsInstance, eventName, eventParams, options)](https://firebase.google.com/docs/reference/js/analytics#logevent_8260753) | Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events). |
| [logEvent(analyticsInstance, eventName, eventParams, options)](https://firebase.google.com/docs/reference/js/analytics#logevent_162cb02) | Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events). |
| [logEvent(analyticsInstance, eventName, eventParams, options)](https://firebase.google.com/docs/reference/js/analytics#logevent_800159e) | Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.See [Measure exceptions](https://developers.google.com/analytics/devguides/collection/ga4/exceptions). |
| [logEvent(analyticsInstance, eventName, eventParams, options)](https://firebase.google.com/docs/reference/js/analytics#logevent_9c11aa9) | Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events). |
| [logEvent(analyticsInstance, eventName, eventParams, options)](https://firebase.google.com/docs/reference/js/analytics#logevent_1f3f282) | Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events). |
| [logEvent(analyticsInstance, eventName, eventParams, options)](https://firebase.google.com/docs/reference/js/analytics#logevent_0792e28) | Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.See [Page views](https://developers.google.com/analytics/devguides/collection/ga4/views). |
| [setAnalyticsCollectionEnabled(analyticsInstance, enabled)](https://firebase.google.com/docs/reference/js/analytics#setanalyticscollectionenabled_494179c) | Sets whether Google Analytics collection is enabled for this app on this device. Sets global `window['ga-disable-analyticsId'] = true;` |
| [setCurrentScreen(analyticsInstance, screenName, options)](https://firebase.google.com/docs/reference/js/analytics#setcurrentscreen_a6168fa) | Use gtag `config` command to set `screen_name`. |
| [setUserId(analyticsInstance, id, options)](https://firebase.google.com/docs/reference/js/analytics#setuserid_86d82f6) | Use gtag `config` command to set `user_id`. |
| [setUserProperties(analyticsInstance, properties, options)](https://firebase.google.com/docs/reference/js/analytics#setuserproperties_877b6e8) | Use gtag `config` command to set all params specified. |
| **function()** |   |
| [isSupported()](https://firebase.google.com/docs/reference/js/analytics#issupported) | This is a public static method provided to users that wraps four different checks:1. Check if it's not a browser extension environment. 2. Check if cookies are enabled in current browser. 3. Check if IndexedDB is supported by the browser environment. 4. Check if the current browser context is valid for using `IndexedDB.open()`. |
| **function(consentSettings, ...)** |   |
| [setConsent(consentSettings)](https://firebase.google.com/docs/reference/js/analytics#setconsent_1697027) | Sets the applicable end user consent state for this web app across all gtag references once Firebase Analytics is initialized.Use the [ConsentSettings](https://firebase.google.com/docs/reference/js/analytics.consentsettings#consentsettings_interface) to specify individual consent type values. By default consent types are set to "granted". |
| **function(customParams, ...)** |   |
| [setDefaultEventParameters(customParams)](https://firebase.google.com/docs/reference/js/analytics#setdefaulteventparameters_0682bee) | Adds data that will be set on every event logged from the SDK, including automatic ones. With gtag's "set" command, the values passed persist on the current page and are passed with all subsequent events. |
| **function(options, ...)** |   |
| [settings(options)](https://firebase.google.com/docs/reference/js/analytics#settings_eb37905) | 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 `getAnalytics()` or it won't have any effect. |

## Interfaces

| Interface | Description |
|---|---|
| [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) | An instance of Firebase Analytics. |
| [AnalyticsCallOptions](https://firebase.google.com/docs/reference/js/analytics.analyticscalloptions#analyticscalloptions_interface) | Additional options that can be passed to Analytics method calls such as `logEvent`, etc. |
| [AnalyticsSettings](https://firebase.google.com/docs/reference/js/analytics.analyticssettings#analyticssettings_interface) | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) instance initialization options. |
| [ConsentSettings](https://firebase.google.com/docs/reference/js/analytics.consentsettings#consentsettings_interface) | Consent status settings for each consent type. For more information, see [the GA4 reference documentation for consent state and consent types](https://developers.google.com/tag-platform/tag-manager/templates/consent-apis). |
| [ControlParams](https://firebase.google.com/docs/reference/js/analytics.controlparams#controlparams_interface) | Standard `gtag.js` control parameters. For more information, see [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events). |
| [CustomParams](https://firebase.google.com/docs/reference/js/analytics.customparams#customparams_interface) | Any custom params the user may pass to `gtag`. |
| [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface) | Standard `gtag.js` event parameters. For more information, see [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events). |
| [GtagConfigParams](https://firebase.google.com/docs/reference/js/analytics.gtagconfigparams#gtagconfigparams_interface) | A set of common Google Analytics config settings recognized by `gtag.js`. |
| [Item](https://firebase.google.com/docs/reference/js/analytics.item#item_interface) | Standard Google Analytics `Item` type. |
| [Promotion](https://firebase.google.com/docs/reference/js/analytics.promotion#promotion_interface) | Field previously used by some Google Analytics events. |
| [SettingsOptions](https://firebase.google.com/docs/reference/js/analytics.settingsoptions#settingsoptions_interface) | Specifies custom options for your Firebase Analytics instance. You must set these before initializing `firebase.analytics()`. |

## Type Aliases

| Type Alias | Description |
|---|---|
| [ConsentStatusString](https://firebase.google.com/docs/reference/js/analytics#consentstatusstring) | Whether a particular consent type has been granted or denied. |
| [Currency](https://firebase.google.com/docs/reference/js/analytics#currency) | Standard Google Analytics currency type. |
| [CustomEventName](https://firebase.google.com/docs/reference/js/analytics#customeventname) | Any custom event name string not in the standard list of recommended event names. |
| [EventNameString](https://firebase.google.com/docs/reference/js/analytics#eventnamestring) | Type for standard Google Analytics event names. `logEvent` also accepts any custom string and interprets it as a custom event name. |

## function(app, ...)

### getAnalytics(app)

Returns an [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) instance for the given app.

**Signature:**

    export declare function getAnalytics(app?: FirebaseApp): Analytics;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| app | [FirebaseApp](https://firebase.google.com/docs/reference/js/app.firebaseapp#firebaseapp_interface) | The [FirebaseApp](https://firebase.google.com/docs/reference/js/app.firebaseapp#firebaseapp_interface) to use. |

**Returns:**

[Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface)

### initializeAnalytics(app, options)

Returns an [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) instance for the given app.

**Signature:**

    export declare function initializeAnalytics(app: FirebaseApp, options?: AnalyticsSettings): Analytics;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| app | [FirebaseApp](https://firebase.google.com/docs/reference/js/app.firebaseapp#firebaseapp_interface) | The [FirebaseApp](https://firebase.google.com/docs/reference/js/app.firebaseapp#firebaseapp_interface) to use. |
| options | [AnalyticsSettings](https://firebase.google.com/docs/reference/js/analytics.analyticssettings#analyticssettings_interface) |   |

**Returns:**

[Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface)

## function(analyticsInstance, ...)

### getGoogleAnalyticsClientId(analyticsInstance)

Retrieves a unique Google Analytics identifier for the web client. See [client_id](https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id).

**Signature:**

    export declare function getGoogleAnalyticsClientId(analyticsInstance: Analytics): Promise<string>;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| analyticsInstance | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) |   |

**Returns:**

Promise\<string\>

### logEvent(analyticsInstance, eventName, eventParams, options)

Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.

List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events).

**Signature:**

    export declare function logEvent(analyticsInstance: Analytics, eventName: 'add_payment_info', eventParams?: {
        coupon?: EventParams['coupon'];
        currency?: EventParams['currency'];
        items?: EventParams['items'];
        payment_type?: EventParams['payment_type'];
        value?: EventParams['value'];
        [key: string]: any;
    }, options?: AnalyticsCallOptions): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| analyticsInstance | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) |   |
| eventName | 'add_payment_info' |   |
| eventParams | { coupon?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['coupon'\]; currency?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['currency'\]; items?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['items'\]; payment_type?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['payment_type'\]; value?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['value'\]; \[key: string\]: any; } |   |
| options | [AnalyticsCallOptions](https://firebase.google.com/docs/reference/js/analytics.analyticscalloptions#analyticscalloptions_interface) |   |

**Returns:**

void

### logEvent(analyticsInstance, eventName, eventParams, options)

Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.

List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events).

**Signature:**

    export declare function logEvent(analyticsInstance: Analytics, eventName: 'purchase' | 'refund', eventParams?: {
        value?: EventParams['value'];
        currency?: EventParams['currency'];
        transaction_id: EventParams['transaction_id'];
        tax?: EventParams['tax'];
        shipping?: EventParams['shipping'];
        items?: EventParams['items'];
        coupon?: EventParams['coupon'];
        affiliation?: EventParams['affiliation'];
        [key: string]: any;
    }, options?: AnalyticsCallOptions): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| analyticsInstance | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) |   |
| eventName | 'purchase' \| 'refund' |   |
| eventParams | { value?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['value'\]; currency?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['currency'\]; transaction_id: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['transaction_id'\]; tax?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['tax'\]; shipping?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['shipping'\]; items?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['items'\]; coupon?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['coupon'\]; affiliation?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['affiliation'\]; \[key: string\]: any; } |   |
| options | [AnalyticsCallOptions](https://firebase.google.com/docs/reference/js/analytics.analyticscalloptions#analyticscalloptions_interface) |   |

**Returns:**

void

### logEvent(analyticsInstance, eventName, eventParams, options)

Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.

See [Track Screenviews](https://firebase.google.com/docs/analytics/screenviews).

**Signature:**

    export declare function logEvent(analyticsInstance: Analytics, eventName: 'screen_view', eventParams?: {
        firebase_screen: EventParams['firebase_screen'];
        firebase_screen_class: EventParams['firebase_screen_class'];
        [key: string]: any;
    }, options?: AnalyticsCallOptions): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| analyticsInstance | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) |   |
| eventName | 'screen_view' |   |
| eventParams | { firebase_screen: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['firebase_screen'\]; firebase_screen_class: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['firebase_screen_class'\]; \[key: string\]: any; } |   |
| options | [AnalyticsCallOptions](https://firebase.google.com/docs/reference/js/analytics.analyticscalloptions#analyticscalloptions_interface) |   |

**Returns:**

void

### logEvent(analyticsInstance, eventName, eventParams, options)

Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.

List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events).

**Signature:**

    export declare function logEvent(analyticsInstance: Analytics, eventName: 'search' | 'view_search_results', eventParams?: {
        search_term?: EventParams['search_term'];
        [key: string]: any;
    }, options?: AnalyticsCallOptions): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| analyticsInstance | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) |   |
| eventName | 'search' \| 'view_search_results' |   |
| eventParams | { search_term?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['search_term'\]; \[key: string\]: any; } |   |
| options | [AnalyticsCallOptions](https://firebase.google.com/docs/reference/js/analytics.analyticscalloptions#analyticscalloptions_interface) |   |

**Returns:**

void

### logEvent(analyticsInstance, eventName, eventParams, options)

Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.

List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events).

**Signature:**

    export declare function logEvent(analyticsInstance: Analytics, eventName: 'select_content', eventParams?: {
        content_type?: EventParams['content_type'];
        item_id?: EventParams['item_id'];
        [key: string]: any;
    }, options?: AnalyticsCallOptions): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| analyticsInstance | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) |   |
| eventName | 'select_content' |   |
| eventParams | { content_type?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['content_type'\]; item_id?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['item_id'\]; \[key: string\]: any; } |   |
| options | [AnalyticsCallOptions](https://firebase.google.com/docs/reference/js/analytics.analyticscalloptions#analyticscalloptions_interface) |   |

**Returns:**

void

### logEvent(analyticsInstance, eventName, eventParams, options)

Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.

List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events).

**Signature:**

    export declare function logEvent(analyticsInstance: Analytics, eventName: 'select_item', eventParams?: {
        items?: EventParams['items'];
        item_list_name?: EventParams['item_list_name'];
        item_list_id?: EventParams['item_list_id'];
        [key: string]: any;
    }, options?: AnalyticsCallOptions): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| analyticsInstance | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) |   |
| eventName | 'select_item' |   |
| eventParams | { items?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['items'\]; item_list_name?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['item_list_name'\]; item_list_id?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['item_list_id'\]; \[key: string\]: any; } |   |
| options | [AnalyticsCallOptions](https://firebase.google.com/docs/reference/js/analytics.analyticscalloptions#analyticscalloptions_interface) |   |

**Returns:**

void

### logEvent(analyticsInstance, eventName, eventParams, options)

Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.

List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events).

**Signature:**

    export declare function logEvent(analyticsInstance: Analytics, eventName: 'select_promotion' | 'view_promotion', eventParams?: {
        items?: EventParams['items'];
        promotion_id?: EventParams['promotion_id'];
        promotion_name?: EventParams['promotion_name'];
        [key: string]: any;
    }, options?: AnalyticsCallOptions): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| analyticsInstance | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) |   |
| eventName | 'select_promotion' \| 'view_promotion' |   |
| eventParams | { items?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['items'\]; promotion_id?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['promotion_id'\]; promotion_name?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['promotion_name'\]; \[key: string\]: any; } |   |
| options | [AnalyticsCallOptions](https://firebase.google.com/docs/reference/js/analytics.analyticscalloptions#analyticscalloptions_interface) |   |

**Returns:**

void

### logEvent(analyticsInstance, eventName, eventParams, options)

Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.

List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events).

**Signature:**

    export declare function logEvent(analyticsInstance: Analytics, eventName: 'set_checkout_option', eventParams?: {
        checkout_step?: EventParams['checkout_step'];
        checkout_option?: EventParams['checkout_option'];
        [key: string]: any;
    }, options?: AnalyticsCallOptions): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| analyticsInstance | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) |   |
| eventName | 'set_checkout_option' |   |
| eventParams | { checkout_step?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['checkout_step'\]; checkout_option?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['checkout_option'\]; \[key: string\]: any; } |   |
| options | [AnalyticsCallOptions](https://firebase.google.com/docs/reference/js/analytics.analyticscalloptions#analyticscalloptions_interface) |   |

**Returns:**

void

### logEvent(analyticsInstance, eventName, eventParams, options)

Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.

List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events).

**Signature:**

    export declare function logEvent(analyticsInstance: Analytics, eventName: 'share', eventParams?: {
        method?: EventParams['method'];
        content_type?: EventParams['content_type'];
        item_id?: EventParams['item_id'];
        [key: string]: any;
    }, options?: AnalyticsCallOptions): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| analyticsInstance | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) |   |
| eventName | 'share' |   |
| eventParams | { method?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['method'\]; content_type?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['content_type'\]; item_id?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['item_id'\]; \[key: string\]: any; } |   |
| options | [AnalyticsCallOptions](https://firebase.google.com/docs/reference/js/analytics.analyticscalloptions#analyticscalloptions_interface) |   |

**Returns:**

void

### logEvent(analyticsInstance, eventName, eventParams, options)

Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.

List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events).

**Signature:**

    export declare function logEvent(analyticsInstance: Analytics, eventName: 'sign_up', eventParams?: {
        method?: EventParams['method'];
        [key: string]: any;
    }, options?: AnalyticsCallOptions): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| analyticsInstance | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) |   |
| eventName | 'sign_up' |   |
| eventParams | { method?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['method'\]; \[key: string\]: any; } |   |
| options | [AnalyticsCallOptions](https://firebase.google.com/docs/reference/js/analytics.analyticscalloptions#analyticscalloptions_interface) |   |

**Returns:**

void

### logEvent(analyticsInstance, eventName, eventParams, options)

Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.

List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events).

**Signature:**

    export declare function logEvent(analyticsInstance: Analytics, eventName: 'timing_complete', eventParams?: {
        name: string;
        value: number;
        event_category?: string;
        event_label?: string;
        [key: string]: any;
    }, options?: AnalyticsCallOptions): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| analyticsInstance | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) |   |
| eventName | 'timing_complete' |   |
| eventParams | { name: string; value: number; event_category?: string; event_label?: string; \[key: string\]: any; } |   |
| options | [AnalyticsCallOptions](https://firebase.google.com/docs/reference/js/analytics.analyticscalloptions#analyticscalloptions_interface) |   |

**Returns:**

void

### logEvent(analyticsInstance, eventName, eventParams, options)

Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.

List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events).

**Signature:**

    export declare function logEvent(analyticsInstance: Analytics, eventName: 'add_shipping_info', eventParams?: {
        coupon?: EventParams['coupon'];
        currency?: EventParams['currency'];
        items?: EventParams['items'];
        shipping_tier?: EventParams['shipping_tier'];
        value?: EventParams['value'];
        [key: string]: any;
    }, options?: AnalyticsCallOptions): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| analyticsInstance | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) |   |
| eventName | 'add_shipping_info' |   |
| eventParams | { coupon?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['coupon'\]; currency?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['currency'\]; items?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['items'\]; shipping_tier?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['shipping_tier'\]; value?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['value'\]; \[key: string\]: any; } |   |
| options | [AnalyticsCallOptions](https://firebase.google.com/docs/reference/js/analytics.analyticscalloptions#analyticscalloptions_interface) |   |

**Returns:**

void

### logEvent(analyticsInstance, eventName, eventParams, options)

Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.

List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events).

**Signature:**

    export declare function logEvent(analyticsInstance: Analytics, eventName: 'view_cart' | 'view_item', eventParams?: {
        currency?: EventParams['currency'];
        items?: EventParams['items'];
        value?: EventParams['value'];
        [key: string]: any;
    }, options?: AnalyticsCallOptions): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| analyticsInstance | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) |   |
| eventName | 'view_cart' \| 'view_item' |   |
| eventParams | { currency?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['currency'\]; items?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['items'\]; value?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['value'\]; \[key: string\]: any; } |   |
| options | [AnalyticsCallOptions](https://firebase.google.com/docs/reference/js/analytics.analyticscalloptions#analyticscalloptions_interface) |   |

**Returns:**

void

### logEvent(analyticsInstance, eventName, eventParams, options)

Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.

List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events).

**Signature:**

    export declare function logEvent(analyticsInstance: Analytics, eventName: 'view_item_list', eventParams?: {
        items?: EventParams['items'];
        item_list_name?: EventParams['item_list_name'];
        item_list_id?: EventParams['item_list_id'];
        [key: string]: any;
    }, options?: AnalyticsCallOptions): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| analyticsInstance | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) |   |
| eventName | 'view_item_list' |   |
| eventParams | { items?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['items'\]; item_list_name?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['item_list_name'\]; item_list_id?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['item_list_id'\]; \[key: string\]: any; } |   |
| options | [AnalyticsCallOptions](https://firebase.google.com/docs/reference/js/analytics.analyticscalloptions#analyticscalloptions_interface) |   |

**Returns:**

void

### logEvent(analyticsInstance, eventName, eventParams, options)

Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.

List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events).

**Signature:**

    export declare function logEvent<T extends string>(analyticsInstance: Analytics, eventName: CustomEventName<T>, eventParams?: {
        [key: string]: any;
    }, options?: AnalyticsCallOptions): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| analyticsInstance | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) |   |
| eventName | [CustomEventName](https://firebase.google.com/docs/reference/js/analytics#customeventname)\<T\> |   |
| eventParams | { \[key: string\]: any; } |   |
| options | [AnalyticsCallOptions](https://firebase.google.com/docs/reference/js/analytics.analyticscalloptions#analyticscalloptions_interface) |   |

**Returns:**

void

### logEvent(analyticsInstance, eventName, eventParams, options)

Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.

List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events).

**Signature:**

    export declare function logEvent(analyticsInstance: Analytics, eventName: 'add_to_cart' | 'add_to_wishlist' | 'remove_from_cart', eventParams?: {
        currency?: EventParams['currency'];
        value?: EventParams['value'];
        items?: EventParams['items'];
        [key: string]: any;
    }, options?: AnalyticsCallOptions): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| analyticsInstance | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) |   |
| eventName | 'add_to_cart' \| 'add_to_wishlist' \| 'remove_from_cart' |   |
| eventParams | { currency?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['currency'\]; value?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['value'\]; items?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['items'\]; \[key: string\]: any; } |   |
| options | [AnalyticsCallOptions](https://firebase.google.com/docs/reference/js/analytics.analyticscalloptions#analyticscalloptions_interface) |   |

**Returns:**

void

### logEvent(analyticsInstance, eventName, eventParams, options)

Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.

List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events).

**Signature:**

    export declare function logEvent(analyticsInstance: Analytics, eventName: 'begin_checkout', eventParams?: {
        currency?: EventParams['currency'];
        coupon?: EventParams['coupon'];
        value?: EventParams['value'];
        items?: EventParams['items'];
        [key: string]: any;
    }, options?: AnalyticsCallOptions): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| analyticsInstance | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) |   |
| eventName | 'begin_checkout' |   |
| eventParams | { currency?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['currency'\]; coupon?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['coupon'\]; value?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['value'\]; items?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['items'\]; \[key: string\]: any; } |   |
| options | [AnalyticsCallOptions](https://firebase.google.com/docs/reference/js/analytics.analyticscalloptions#analyticscalloptions_interface) |   |

**Returns:**

void

### logEvent(analyticsInstance, eventName, eventParams, options)

Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.

List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events).

**Signature:**

    export declare function logEvent(analyticsInstance: Analytics, eventName: 'checkout_progress', eventParams?: {
        currency?: EventParams['currency'];
        coupon?: EventParams['coupon'];
        value?: EventParams['value'];
        items?: EventParams['items'];
        checkout_step?: EventParams['checkout_step'];
        checkout_option?: EventParams['checkout_option'];
        [key: string]: any;
    }, options?: AnalyticsCallOptions): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| analyticsInstance | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) |   |
| eventName | 'checkout_progress' |   |
| eventParams | { currency?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['currency'\]; coupon?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['coupon'\]; value?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['value'\]; items?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['items'\]; checkout_step?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['checkout_step'\]; checkout_option?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['checkout_option'\]; \[key: string\]: any; } |   |
| options | [AnalyticsCallOptions](https://firebase.google.com/docs/reference/js/analytics.analyticscalloptions#analyticscalloptions_interface) |   |

**Returns:**

void

### logEvent(analyticsInstance, eventName, eventParams, options)

Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.

See [Measure exceptions](https://developers.google.com/analytics/devguides/collection/ga4/exceptions).

**Signature:**

    export declare function logEvent(analyticsInstance: Analytics, eventName: 'exception', eventParams?: {
        description?: EventParams['description'];
        fatal?: EventParams['fatal'];
        [key: string]: any;
    }, options?: AnalyticsCallOptions): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| analyticsInstance | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) |   |
| eventName | 'exception' |   |
| eventParams | { description?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['description'\]; fatal?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['fatal'\]; \[key: string\]: any; } |   |
| options | [AnalyticsCallOptions](https://firebase.google.com/docs/reference/js/analytics.analyticscalloptions#analyticscalloptions_interface) |   |

**Returns:**

void

### logEvent(analyticsInstance, eventName, eventParams, options)

Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.

List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events).

**Signature:**

    export declare function logEvent(analyticsInstance: Analytics, eventName: 'generate_lead', eventParams?: {
        value?: EventParams['value'];
        currency?: EventParams['currency'];
        [key: string]: any;
    }, options?: AnalyticsCallOptions): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| analyticsInstance | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) |   |
| eventName | 'generate_lead' |   |
| eventParams | { value?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['value'\]; currency?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['currency'\]; \[key: string\]: any; } |   |
| options | [AnalyticsCallOptions](https://firebase.google.com/docs/reference/js/analytics.analyticscalloptions#analyticscalloptions_interface) |   |

**Returns:**

void

### logEvent(analyticsInstance, eventName, eventParams, options)

Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.

List of recommended event parameters can be found in [the GA4 reference documentation](https://developers.google.com/gtagjs/reference/ga4-events).

**Signature:**

    export declare function logEvent(analyticsInstance: Analytics, eventName: 'login', eventParams?: {
        method?: EventParams['method'];
        [key: string]: any;
    }, options?: AnalyticsCallOptions): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| analyticsInstance | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) |   |
| eventName | 'login' |   |
| eventParams | { method?: [EventParams](https://firebase.google.com/docs/reference/js/analytics.eventparams#eventparams_interface)\['method'\]; \[key: string\]: any; } |   |
| options | [AnalyticsCallOptions](https://firebase.google.com/docs/reference/js/analytics.analyticscalloptions#analyticscalloptions_interface) |   |

**Returns:**

void

### logEvent(analyticsInstance, eventName, eventParams, options)

Sends a Google Analytics event with given `eventParams`. This method automatically associates this logged event with this Firebase web app instance on this device.

See [Page views](https://developers.google.com/analytics/devguides/collection/ga4/views).

**Signature:**

    export declare function logEvent(analyticsInstance: Analytics, eventName: 'page_view', eventParams?: {
        page_title?: string;
        page_location?: string;
        page_path?: string;
        [key: string]: any;
    }, options?: AnalyticsCallOptions): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| analyticsInstance | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) |   |
| eventName | 'page_view' |   |
| eventParams | { page_title?: string; page_location?: string; page_path?: string; \[key: string\]: any; } |   |
| options | [AnalyticsCallOptions](https://firebase.google.com/docs/reference/js/analytics.analyticscalloptions#analyticscalloptions_interface) |   |

**Returns:**

void

### setAnalyticsCollectionEnabled(analyticsInstance, enabled)

Sets whether Google Analytics collection is enabled for this app on this device. Sets global `window['ga-disable-analyticsId'] = true;`

**Signature:**

    export declare function setAnalyticsCollectionEnabled(analyticsInstance: Analytics, enabled: boolean): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| analyticsInstance | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) | The [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) instance. |
| enabled | boolean | If true, enables collection, if false, disables it. |

**Returns:**

void

### setCurrentScreen(analyticsInstance, screenName, options)

> > [!WARNING]
> > **Warning:** This API is now obsolete.
>
> Use [logEvent](https://firebase.google.com/docs/reference/js/analytics#logevent_d5f1743) with `eventName` as 'screen_view' and add relevant `eventParams`. See [Track Screenviews](https://firebase.google.com/docs/analytics/screenviews).

Use gtag `config` command to set `screen_name`.

**Signature:**

    export declare function setCurrentScreen(analyticsInstance: Analytics, screenName: string, options?: AnalyticsCallOptions): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| analyticsInstance | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) | The [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) instance. |
| screenName | string | Screen name to set. |
| options | [AnalyticsCallOptions](https://firebase.google.com/docs/reference/js/analytics.analyticscalloptions#analyticscalloptions_interface) |   |

**Returns:**

void

### setUserId(analyticsInstance, id, options)

Use gtag `config` command to set `user_id`.

**Signature:**

    export declare function setUserId(analyticsInstance: Analytics, id: string | null, options?: AnalyticsCallOptions): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| analyticsInstance | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) | The [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) instance. |
| id | string \| null | User ID to set. |
| options | [AnalyticsCallOptions](https://firebase.google.com/docs/reference/js/analytics.analyticscalloptions#analyticscalloptions_interface) |   |

**Returns:**

void

### setUserProperties(analyticsInstance, properties, options)

Use gtag `config` command to set all params specified.

**Signature:**

    export declare function setUserProperties(analyticsInstance: Analytics, properties: CustomParams, options?: AnalyticsCallOptions): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| analyticsInstance | [Analytics](https://firebase.google.com/docs/reference/js/analytics.analytics#analytics_interface) |   |
| properties | [CustomParams](https://firebase.google.com/docs/reference/js/analytics.customparams#customparams_interface) |   |
| options | [AnalyticsCallOptions](https://firebase.google.com/docs/reference/js/analytics.analyticscalloptions#analyticscalloptions_interface) |   |

**Returns:**

void

## function()

### isSupported()

This is a public static method provided to users that wraps four different checks:

1. Check if it's not a browser extension environment. 2. Check if cookies are enabled in current browser. 3. Check if IndexedDB is supported by the browser environment. 4. Check if the current browser context is valid for using `IndexedDB.open()`.

**Signature:**

    export declare function isSupported(): Promise<boolean>;

**Returns:**

Promise\<boolean\>

## function(consentSettings, ...)

### setConsent(consentSettings)

Sets the applicable end user consent state for this web app across all gtag references once Firebase Analytics is initialized.

Use the [ConsentSettings](https://firebase.google.com/docs/reference/js/analytics.consentsettings#consentsettings_interface) to specify individual consent type values. By default consent types are set to "granted".

**Signature:**

    export declare function setConsent(consentSettings: ConsentSettings): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| consentSettings | [ConsentSettings](https://firebase.google.com/docs/reference/js/analytics.consentsettings#consentsettings_interface) | Maps the applicable end user consent state for gtag.js. |

**Returns:**

void

## function(customParams, ...)

### setDefaultEventParameters(customParams)

Adds data that will be set on every event logged from the SDK, including automatic ones. With gtag's "set" command, the values passed persist on the current page and are passed with all subsequent events.

**Signature:**

    export declare function setDefaultEventParameters(customParams: CustomParams): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| customParams | [CustomParams](https://firebase.google.com/docs/reference/js/analytics.customparams#customparams_interface) | Any custom params the user may pass to gtag.js. |

**Returns:**

void

## function(options, ...)

### settings(options)

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 `getAnalytics()` or it won't have any effect.

**Signature:**

    export declare function settings(options: SettingsOptions): void;

#### Parameters

| Parameter | Type | Description |
|---|---|---|
| options | [SettingsOptions](https://firebase.google.com/docs/reference/js/analytics.settingsoptions#settingsoptions_interface) | Custom gtag and dataLayer names. |

**Returns:**

void

## ConsentStatusString

Whether a particular consent type has been granted or denied.

**Signature:**

    export type ConsentStatusString = 'granted' | 'denied';

## Currency

Standard Google Analytics currency type.

**Signature:**

    export type Currency = string | number;

## CustomEventName

Any custom event name string not in the standard list of recommended event names.

**Signature:**

    export type CustomEventName<T> = T extends EventNameString ? never : T;

## EventNameString

Type for standard Google Analytics event names. `logEvent` also accepts any custom string and interprets it as a custom event name.

**Signature:**

    export type 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';