@firebase/analytics-types

  • Version 0.7.0
  • Published
  • 22.4 kB
  • No dependencies
  • Apache-2.0 license

Install

npm i @firebase/analytics-types
yarn add @firebase/analytics-types
pnpm add @firebase/analytics-types

Overview

@firebase/analytics Types

Index

Interfaces

interface AnalyticsCallOptions

interface AnalyticsCallOptions {}
  • Additional options that can be passed to Firebase Analytics method calls such as logEvent, setCurrentScreen, etc.

property global

global: boolean;
  • If true, this config or event call applies globally to all analytics properties on the page.

interface ControlParams

interface ControlParams {}
  • Standard gtag.js control parameters. For more information, see .

property event_callback

event_callback?: () => void;

    property event_timeout

    event_timeout?: number;

      property groups

      groups?: string | string[];

        property send_to

        send_to?: string | string[];

          interface CustomParams

          interface CustomParams {}
          • Any custom params the user may pass to gtag.js.

          index signature

          [key: string]: any;

            interface DynamicConfig

            interface DynamicConfig {}
            • Dynamic configuration fetched from server. See https://firebase.google.com/docs/projects/api/reference/rest/v1beta1/projects.webApps/getConfig

            property apiKey

            apiKey: string;

              property appId

              appId: string;

                property authDomain

                authDomain: string;

                  property databaseURL

                  databaseURL: string;

                    property locationId

                    locationId: string;

                      property measurementId

                      measurementId: string;

                        property messagingSenderId

                        messagingSenderId: string;

                          property projectId

                          projectId: string;

                            property storageBucket

                            storageBucket: string;

                              interface EventParams

                              interface EventParams {}
                              • Standard gtag.js event parameters. For more information, see .

                              property affiliation

                              affiliation?: string;

                                property checkout_option

                                checkout_option?: string;

                                  property checkout_step

                                  checkout_step?: number;

                                    property content_type

                                    content_type?: string;

                                      property coupon

                                      coupon?: string;

                                        property currency

                                        currency?: string;

                                          property description

                                          description?: string;

                                            property event_category

                                            event_category?: string;

                                              property event_label

                                              event_label?: string;

                                                property fatal

                                                fatal?: boolean;

                                                  property firebase_screen

                                                  firebase_screen?: string;
                                                  • Firebase-specific. Use to log a screen_name to Firebase Analytics.

                                                  property firebase_screen_class

                                                  firebase_screen_class?: string;
                                                  • Firebase-specific. Use to log a screen_class to Firebase Analytics.

                                                  property item_id

                                                  item_id?: string;

                                                    property item_list_id

                                                    item_list_id?: string;

                                                      property item_list_name

                                                      item_list_name?: string;

                                                        property items

                                                        items?: Item[];

                                                          property method

                                                          method?: string;

                                                            property number

                                                            number?: string;

                                                              property payment_type

                                                              payment_type?: string;

                                                                property promotion_id

                                                                promotion_id?: string;

                                                                  property promotion_name

                                                                  promotion_name?: string;

                                                                    property promotions

                                                                    promotions?: Promotion[];

                                                                      property screen_name

                                                                      screen_name?: string;

                                                                        property search_term

                                                                        search_term?: string;

                                                                          property shipping

                                                                          shipping?: Currency;

                                                                            property shipping_tier

                                                                            shipping_tier?: string;

                                                                              property tax

                                                                              tax?: Currency;

                                                                                property transaction_id

                                                                                transaction_id?: string;

                                                                                  property value

                                                                                  value?: number;

                                                                                    interface FirebaseAnalytics

                                                                                    interface FirebaseAnalytics {}

                                                                                      property app

                                                                                      app: FirebaseApp;

                                                                                        method logEvent

                                                                                        logEvent: {
                                                                                        (
                                                                                        eventName: 'add_payment_info',
                                                                                        eventParams?: {
                                                                                        [key: string]: any;
                                                                                        coupon?: EventParams['coupon'];
                                                                                        currency?: EventParams['currency'];
                                                                                        items?: EventParams['items'];
                                                                                        payment_type?: EventParams['payment_type'];
                                                                                        value?: EventParams['value'];
                                                                                        },
                                                                                        options?: AnalyticsCallOptions
                                                                                        ): void;
                                                                                        (
                                                                                        eventName: 'add_shipping_info',
                                                                                        eventParams?: {
                                                                                        [key: string]: any;
                                                                                        coupon?: string;
                                                                                        currency?: string;
                                                                                        items?: Item[];
                                                                                        shipping_tier?: string;
                                                                                        value?: number;
                                                                                        },
                                                                                        options?: AnalyticsCallOptions
                                                                                        ): void;
                                                                                        (
                                                                                        eventName: 'add_to_cart' | 'add_to_wishlist' | 'remove_from_cart',
                                                                                        eventParams?: {
                                                                                        [key: string]: any;
                                                                                        currency?: string;
                                                                                        value?: number;
                                                                                        items?: Item[];
                                                                                        },
                                                                                        options?: AnalyticsCallOptions
                                                                                        ): void;
                                                                                        (
                                                                                        eventName: 'begin_checkout',
                                                                                        eventParams?: {
                                                                                        [key: string]: any;
                                                                                        currency?: string;
                                                                                        coupon?: string;
                                                                                        value?: number;
                                                                                        items?: Item[];
                                                                                        },
                                                                                        options?: AnalyticsCallOptions
                                                                                        ): void;
                                                                                        (
                                                                                        eventName: 'checkout_progress',
                                                                                        eventParams?: {
                                                                                        [key: string]: any;
                                                                                        currency?: string;
                                                                                        coupon?: string;
                                                                                        value?: number;
                                                                                        items?: Item[];
                                                                                        checkout_step?: number;
                                                                                        checkout_option?: string;
                                                                                        },
                                                                                        options?: AnalyticsCallOptions
                                                                                        ): void;
                                                                                        (
                                                                                        eventName: 'exception',
                                                                                        eventParams?: {
                                                                                        [key: string]: any;
                                                                                        description?: string;
                                                                                        fatal?: boolean;
                                                                                        },
                                                                                        options?: AnalyticsCallOptions
                                                                                        ): void;
                                                                                        (
                                                                                        eventName: 'generate_lead',
                                                                                        eventParams?: { [key: string]: any; value?: number; currency?: string },
                                                                                        options?: AnalyticsCallOptions
                                                                                        ): void;
                                                                                        (
                                                                                        eventName: 'login',
                                                                                        eventParams?: { [key: string]: any; method?: string },
                                                                                        options?: AnalyticsCallOptions
                                                                                        ): void;
                                                                                        (
                                                                                        eventName: 'page_view',
                                                                                        eventParams?: {
                                                                                        [key: string]: any;
                                                                                        page_title?: string;
                                                                                        page_location?: string;
                                                                                        page_path?: string;
                                                                                        },
                                                                                        options?: AnalyticsCallOptions
                                                                                        ): void;
                                                                                        (
                                                                                        eventName: 'purchase' | 'refund',
                                                                                        eventParams?: {
                                                                                        [key: string]: any;
                                                                                        value?: number;
                                                                                        currency?: string;
                                                                                        transaction_id: string;
                                                                                        tax?: Currency;
                                                                                        shipping?: Currency;
                                                                                        items?: Item[];
                                                                                        coupon?: string;
                                                                                        affiliation?: string;
                                                                                        },
                                                                                        options?: AnalyticsCallOptions
                                                                                        ): void;
                                                                                        (
                                                                                        eventName: 'screen_view',
                                                                                        eventParams?: {
                                                                                        [key: string]: any;
                                                                                        firebase_screen: string;
                                                                                        firebase_screen_class: string;
                                                                                        },
                                                                                        options?: AnalyticsCallOptions
                                                                                        ): void;
                                                                                        (
                                                                                        eventName: 'search' | 'view_search_results',
                                                                                        eventParams?: { [key: string]: any; search_term?: string },
                                                                                        options?: AnalyticsCallOptions
                                                                                        ): void;
                                                                                        (
                                                                                        eventName: 'select_content',
                                                                                        eventParams?: {
                                                                                        [key: string]: any;
                                                                                        content_type?: string;
                                                                                        item_id?: string;
                                                                                        },
                                                                                        options?: AnalyticsCallOptions
                                                                                        ): void;
                                                                                        (
                                                                                        eventName: 'select_item',
                                                                                        eventParams?: {
                                                                                        [key: string]: any;
                                                                                        items?: Item[];
                                                                                        item_list_name?: string;
                                                                                        item_list_id?: string;
                                                                                        },
                                                                                        options?: AnalyticsCallOptions
                                                                                        ): void;
                                                                                        (
                                                                                        eventName: 'select_promotion' | 'view_promotion',
                                                                                        eventParams?: {
                                                                                        [key: string]: any;
                                                                                        items?: Item[];
                                                                                        promotion_id?: string;
                                                                                        promotion_name?: string;
                                                                                        },
                                                                                        options?: AnalyticsCallOptions
                                                                                        ): void;
                                                                                        (
                                                                                        eventName: 'set_checkout_option',
                                                                                        eventParams?: {
                                                                                        [key: string]: any;
                                                                                        checkout_step?: number;
                                                                                        checkout_option?: string;
                                                                                        },
                                                                                        options?: AnalyticsCallOptions
                                                                                        ): void;
                                                                                        (
                                                                                        eventName: 'share',
                                                                                        eventParams?: {
                                                                                        [key: string]: any;
                                                                                        method?: string;
                                                                                        content_type?: string;
                                                                                        item_id?: string;
                                                                                        },
                                                                                        options?: AnalyticsCallOptions
                                                                                        ): void;
                                                                                        (
                                                                                        eventName: 'sign_up',
                                                                                        eventParams?: { [key: string]: any; method?: string },
                                                                                        options?: AnalyticsCallOptions
                                                                                        ): void;
                                                                                        (
                                                                                        eventName: 'timing_complete',
                                                                                        eventParams?: {
                                                                                        [key: string]: any;
                                                                                        name: string;
                                                                                        value: number;
                                                                                        event_category?: string;
                                                                                        event_label?: string;
                                                                                        },
                                                                                        options?: AnalyticsCallOptions
                                                                                        ): void;
                                                                                        (
                                                                                        eventName: 'view_cart' | 'view_item',
                                                                                        eventParams?: {
                                                                                        [key: string]: any;
                                                                                        currency?: string;
                                                                                        items?: Item[];
                                                                                        value?: number;
                                                                                        },
                                                                                        options?: AnalyticsCallOptions
                                                                                        ): void;
                                                                                        (
                                                                                        eventName: 'view_item_list',
                                                                                        eventParams?: {
                                                                                        [key: string]: any;
                                                                                        items?: Item[];
                                                                                        item_list_name?: string;
                                                                                        item_list_id?: string;
                                                                                        },
                                                                                        options?: AnalyticsCallOptions
                                                                                        ): void;
                                                                                        <T extends string>(
                                                                                        eventName: CustomEventName<T>,
                                                                                        eventParams?: { [key: string]: any },
                                                                                        options?: AnalyticsCallOptions
                                                                                        ): void;
                                                                                        };
                                                                                        • Sends 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.

                                                                                        • Sends analytics event with given eventParams. This method automatically associates this logged event with this Firebase web app instance on this device. See Measure exceptions.

                                                                                        • Sends analytics event with given eventParams. This method automatically associates this logged event with this Firebase web app instance on this device. See Page views.

                                                                                        • Sends analytics event with given eventParams. This method automatically associates this logged event with this Firebase web app instance on this device. See Track Screenviews.

                                                                                        method setAnalyticsCollectionEnabled

                                                                                        setAnalyticsCollectionEnabled: (enabled: boolean) => void;
                                                                                        • Sets whether analytics collection is enabled for this app on this device. window['ga-disable-analyticsId'] = true;

                                                                                        method setCurrentScreen

                                                                                        setCurrentScreen: (screenName: string, options?: AnalyticsCallOptions) => void;
                                                                                        • Use gtag 'config' command to set 'screen_name'.

                                                                                        method setUserId

                                                                                        setUserId: (id: string, options?: AnalyticsCallOptions) => void;
                                                                                        • Use gtag 'config' command to set 'user_id'.

                                                                                        method setUserProperties

                                                                                        setUserProperties: (
                                                                                        properties: { [key: string]: any },
                                                                                        options?: AnalyticsCallOptions
                                                                                        ) => void;
                                                                                        • Use gtag 'config' command to set all params specified.

                                                                                        interface Gtag

                                                                                        interface Gtag {}
                                                                                        • Standard gtag function provided by gtag.js.

                                                                                        call signature

                                                                                        (
                                                                                        command: 'config',
                                                                                        targetId: string,
                                                                                        config?: ControlParams | EventParams | CustomParams
                                                                                        ): void;

                                                                                          call signature

                                                                                          (command: 'set', config: CustomParams): void;

                                                                                            call signature

                                                                                            (
                                                                                            command: 'event',
                                                                                            eventName: string,
                                                                                            eventParams?: ControlParams | EventParams | CustomParams
                                                                                            ): void;

                                                                                              interface Item

                                                                                              interface Item {}

                                                                                                property affiliation

                                                                                                affiliation?: string;

                                                                                                  property brand

                                                                                                  brand?: string;
                                                                                                  • Deprecated

                                                                                                    Use item_brand instead.

                                                                                                  property category

                                                                                                  category?: string;
                                                                                                  • Deprecated

                                                                                                    Use item_category instead.

                                                                                                  property coupon

                                                                                                  coupon?: string;

                                                                                                    property creative_name

                                                                                                    creative_name?: string;

                                                                                                      property creative_slot

                                                                                                      creative_slot?: string;

                                                                                                        property discount

                                                                                                        discount?: Currency;

                                                                                                          property id

                                                                                                          id?: string;
                                                                                                          • Deprecated

                                                                                                            Use item_id instead.

                                                                                                          property index

                                                                                                          index?: number;

                                                                                                            property item_brand

                                                                                                            item_brand?: string;

                                                                                                              property item_category

                                                                                                              item_category?: string;

                                                                                                                property item_category2

                                                                                                                item_category2?: string;

                                                                                                                  property item_category3

                                                                                                                  item_category3?: string;

                                                                                                                    property item_category4

                                                                                                                    item_category4?: string;

                                                                                                                      property item_category5

                                                                                                                      item_category5?: string;

                                                                                                                        property item_id

                                                                                                                        item_id?: string;

                                                                                                                          property item_list_id

                                                                                                                          item_list_id?: string;

                                                                                                                            property item_list_name

                                                                                                                            item_list_name?: string;

                                                                                                                              property item_name

                                                                                                                              item_name?: string;

                                                                                                                                property item_variant

                                                                                                                                item_variant?: string;

                                                                                                                                  property location_id

                                                                                                                                  location_id?: string;

                                                                                                                                    property name

                                                                                                                                    name?: string;
                                                                                                                                    • Deprecated

                                                                                                                                      Use item_name instead.

                                                                                                                                    property price

                                                                                                                                    price?: Currency;

                                                                                                                                      property promotion_id

                                                                                                                                      promotion_id?: string;

                                                                                                                                        property promotion_name

                                                                                                                                        promotion_name?: string;

                                                                                                                                          property quantity

                                                                                                                                          quantity?: number;

                                                                                                                                            interface MinimalDynamicConfig

                                                                                                                                            interface MinimalDynamicConfig {}

                                                                                                                                              property appId

                                                                                                                                              appId: string;

                                                                                                                                                property measurementId

                                                                                                                                                measurementId: string;

                                                                                                                                                  interface Promotion

                                                                                                                                                  interface Promotion {}
                                                                                                                                                  • Deprecated

                                                                                                                                                    Use Item instead.

                                                                                                                                                  property creative_name

                                                                                                                                                  creative_name?: string;

                                                                                                                                                    property creative_slot

                                                                                                                                                    creative_slot?: string;

                                                                                                                                                      property id

                                                                                                                                                      id?: string;

                                                                                                                                                        property name

                                                                                                                                                        name?: string;

                                                                                                                                                          interface SettingsOptions

                                                                                                                                                          interface SettingsOptions {}
                                                                                                                                                          • Specifies custom options for your Firebase Analytics instance. You must set these before initializing firebase.analytics().

                                                                                                                                                          property dataLayerName

                                                                                                                                                          dataLayerName?: string;
                                                                                                                                                          • Sets custom name for dataLayer array used by gtag.

                                                                                                                                                          property gtagName

                                                                                                                                                          gtagName?: string;
                                                                                                                                                          • Sets custom name for gtag function.

                                                                                                                                                          interface ThrottleMetadata

                                                                                                                                                          interface ThrottleMetadata {}
                                                                                                                                                          • Encapsulates metadata concerning throttled fetch requests.

                                                                                                                                                          property backoffCount

                                                                                                                                                          backoffCount: number;

                                                                                                                                                            property throttleEndTimeMillis

                                                                                                                                                            throttleEndTimeMillis: number;

                                                                                                                                                              Type Aliases

                                                                                                                                                              type Currency

                                                                                                                                                              type Currency = string | number;

                                                                                                                                                                type CustomEventName

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

                                                                                                                                                                  type DataLayer

                                                                                                                                                                  type DataLayer = Array<IArguments>;

                                                                                                                                                                    type EventNameString

                                                                                                                                                                    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';
                                                                                                                                                                    • Type for standard gtag.js event names. logEvent also accepts any custom string and interprets it as a custom event name.

                                                                                                                                                                    type GtagCommand

                                                                                                                                                                    type GtagCommand = 'event' | 'set' | 'config';

                                                                                                                                                                      Package Files (1)

                                                                                                                                                                      Dependencies (0)

                                                                                                                                                                      No dependencies.

                                                                                                                                                                      Dev Dependencies (1)

                                                                                                                                                                      Peer Dependencies (0)

                                                                                                                                                                      No peer dependencies.

                                                                                                                                                                      Badge

                                                                                                                                                                      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@firebase/analytics-types.

                                                                                                                                                                      • Markdown
                                                                                                                                                                        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@firebase/analytics-types)
                                                                                                                                                                      • HTML
                                                                                                                                                                        <a href="https://www.jsdocs.io/package/@firebase/analytics-types"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>