Deployed the page to Github Pages.

This commit is contained in:
Batuhan Berk Başoğlu 2024-11-03 21:30:09 -05:00
parent 1d79754e93
commit 2c89899458
Signed by: batuhan-basoglu
SSH key fingerprint: SHA256:kEsnuHX+qbwhxSAXPUQ4ox535wFHu/hIRaa53FzxRpo
62797 changed files with 6551425 additions and 15279 deletions

5
node_modules/@firebase/analytics/README.md generated vendored Normal file
View file

@ -0,0 +1,5 @@
# @firebase/analytics
This is the Firebase Analytics component of the Firebase JS SDK.
**This package is not intended for direct usage, and should only be used via the officially supported [firebase](https://www.npmjs.com/package/firebase) package.**

View file

@ -0,0 +1,763 @@
/**
* The Firebase Analytics Web SDK.
* This SDK does not work in a Node.js environment.
*
* @packageDocumentation
*/
import { FirebaseApp } from '@firebase/app';
/**
* An instance of Firebase Analytics.
* @public
*/
export declare interface Analytics {
/**
* The {@link @firebase/app#FirebaseApp} this {@link Analytics} instance is associated with.
*/
app: FirebaseApp;
}
/**
* Additional options that can be passed to Analytics method
* calls such as `logEvent`, etc.
* @public
*/
export declare interface AnalyticsCallOptions {
/**
* If true, this config or event call applies globally to all
* Google Analytics properties on the page.
*/
global: boolean;
}
/**
* {@link Analytics} instance initialization options.
* @public
*/
export declare interface AnalyticsSettings {
/**
* Params to be passed in the initial `gtag` config call during Firebase
* Analytics initialization.
*/
config?: GtagConfigParams | EventParams;
}
/**
* Consent status settings for each consent type.
* For more information, see
* {@link https://developers.google.com/tag-platform/tag-manager/templates/consent-apis
* | the GA4 reference documentation for consent state and consent types}.
* @public
*/
export declare interface ConsentSettings {
/** Enables storage, such as cookies, related to advertising */
ad_storage?: ConsentStatusString;
/** Sets consent for sending user data to Google for advertising purposes. */
ad_user_data?: ConsentStatusString;
/** Sets consent for personalized advertising. */
ad_personalization?: ConsentStatusString;
/** Enables storage, such as cookies, related to analytics (for example, visit duration) */
analytics_storage?: ConsentStatusString;
/**
* Enables storage that supports the functionality of the website or app such as language settings
*/
functionality_storage?: ConsentStatusString;
/** Enables storage related to personalization such as video recommendations */
personalization_storage?: ConsentStatusString;
/**
* Enables storage related to security such as authentication functionality, fraud prevention,
* and other user protection.
*/
security_storage?: ConsentStatusString;
[key: string]: unknown;
}
/**
* Whether a particular consent type has been granted or denied.
* @public
*/
export declare type ConsentStatusString = 'granted' | 'denied';
/**
* Standard `gtag.js` control parameters.
* For more information, see
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
* @public
*/
export declare interface ControlParams {
groups?: string | string[];
send_to?: string | string[];
event_callback?: () => void;
event_timeout?: number;
}
/**
* Standard Google Analytics currency type.
* @public
*/
export declare type Currency = string | number;
/**
* Any custom event name string not in the standard list of recommended
* event names.
* @public
*/
export declare type CustomEventName<T> = T extends EventNameString ? never : T;
/**
* Any custom params the user may pass to `gtag`.
* @public
*/
export declare interface CustomParams {
[key: string]: unknown;
}
/**
* Type for standard Google Analytics event names. `logEvent` also accepts any
* custom string and interprets it as a custom event name.
* @public
*/
export declare 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';
/**
* Standard `gtag.js` event parameters.
* For more information, see
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
* @public
*/
export declare interface EventParams {
checkout_option?: string;
checkout_step?: number;
item_id?: string;
content_type?: string;
coupon?: string;
currency?: string;
description?: string;
fatal?: boolean;
items?: Item[];
method?: string;
number?: string;
promotions?: Promotion[];
screen_name?: string;
/**
* Firebase-specific. Use to log a `screen_name` to Firebase Analytics.
*/
firebase_screen?: string;
/**
* Firebase-specific. Use to log a `screen_class` to Firebase Analytics.
*/
firebase_screen_class?: string;
search_term?: string;
shipping?: Currency;
tax?: Currency;
transaction_id?: string;
value?: number;
event_label?: string;
event_category?: string;
shipping_tier?: string;
item_list_id?: string;
item_list_name?: string;
promotion_id?: string;
promotion_name?: string;
payment_type?: string;
affiliation?: string;
page_title?: string;
page_location?: string;
page_path?: string;
[key: string]: unknown;
}
/**
* Returns an {@link Analytics} instance for the given app.
*
* @public
*
* @param app - The {@link @firebase/app#FirebaseApp} to use.
*/
export declare function getAnalytics(app?: FirebaseApp): Analytics;
/**
* Retrieves a unique Google Analytics identifier for the web client.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}.
*
* @public
*
* @param app - The {@link @firebase/app#FirebaseApp} to use.
*/
export declare function getGoogleAnalyticsClientId(analyticsInstance: Analytics): Promise<string>;
/**
* A set of common Google Analytics config settings recognized by
* `gtag.js`.
* @public
*/
export declare interface GtagConfigParams {
/**
* Whether or not a page view should be sent.
* If set to true (default), a page view is automatically sent upon initialization
* of analytics.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views }
*/
'send_page_view'?: boolean;
/**
* The title of the page.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views }
*/
'page_title'?: string;
/**
* The URL of the page.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views }
*/
'page_location'?: string;
/**
* Defaults to `auto`.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
*/
'cookie_domain'?: string;
/**
* Defaults to 63072000 (two years, in seconds).
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
*/
'cookie_expires'?: number;
/**
* Defaults to `_ga`.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
*/
'cookie_prefix'?: string;
/**
* If set to true, will update cookies on each page load.
* Defaults to true.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
*/
'cookie_update'?: boolean;
/**
* Appends additional flags to the cookie when set.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
*/
'cookie_flags'?: string;
/**
* If set to false, disables all advertising features with `gtag.js`.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features }
*/
'allow_google_signals'?: boolean;
/**
* If set to false, disables all advertising personalization with `gtag.js`.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features }
*/
'allow_ad_personalization_signals'?: boolean;
[key: string]: unknown;
}
/**
* Returns an {@link Analytics} instance for the given app.
*
* @public
*
* @param app - The {@link @firebase/app#FirebaseApp} to use.
*/
export declare function initializeAnalytics(app: FirebaseApp, options?: AnalyticsSettings): Analytics;
/**
* 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()`.
*
* @public
*
*/
export declare function isSupported(): Promise<boolean>;
/**
* Standard Google Analytics `Item` type.
* @public
*/
export declare interface Item {
item_id?: string;
item_name?: string;
item_brand?: string;
item_category?: string;
item_category2?: string;
item_category3?: string;
item_category4?: string;
item_category5?: string;
item_variant?: string;
price?: Currency;
quantity?: number;
index?: number;
coupon?: string;
item_list_name?: string;
item_list_id?: string;
discount?: Currency;
affiliation?: string;
creative_name?: string;
creative_slot?: string;
promotion_id?: string;
promotion_name?: string;
location_id?: string;
/** @deprecated Use item_brand instead. */
brand?: string;
/** @deprecated Use item_category instead. */
category?: string;
/** @deprecated Use item_id instead. */
id?: string;
/** @deprecated Use item_name instead. */
name?: string;
}
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* See
* {@link https://developers.google.com/analytics/devguides/collection/ga4/exceptions
* | Measure exceptions}.
*/
export declare function logEvent(analyticsInstance: Analytics, eventName: 'exception', eventParams?: {
description?: EventParams['description'];
fatal?: EventParams['fatal'];
[key: string]: any;
}, options?: AnalyticsCallOptions): void;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
export declare function logEvent(analyticsInstance: Analytics, eventName: 'generate_lead', eventParams?: {
value?: EventParams['value'];
currency?: EventParams['currency'];
[key: string]: any;
}, options?: AnalyticsCallOptions): void;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
export declare function logEvent(analyticsInstance: Analytics, eventName: 'login', eventParams?: {
method?: EventParams['method'];
[key: string]: any;
}, options?: AnalyticsCallOptions): void;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* See
* {@link https://developers.google.com/analytics/devguides/collection/ga4/views
* | Page views}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* See {@link https://firebase.google.com/docs/analytics/screenviews
* | Track Screenviews}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
export declare function logEvent(analyticsInstance: Analytics, eventName: 'search' | 'view_search_results', eventParams?: {
search_term?: EventParams['search_term'];
[key: string]: any;
}, options?: AnalyticsCallOptions): void;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
export declare function logEvent(analyticsInstance: Analytics, eventName: 'sign_up', eventParams?: {
method?: EventParams['method'];
[key: string]: any;
}, options?: AnalyticsCallOptions): void;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
export declare function logEvent<T extends string>(analyticsInstance: Analytics, eventName: CustomEventName<T>, eventParams?: {
[key: string]: any;
}, options?: AnalyticsCallOptions): void;
/**
* Field previously used by some Google Analytics events.
* @deprecated Use `Item` instead.
* @public
*/
export declare interface Promotion {
creative_name?: string;
creative_slot?: string;
id?: string;
name?: string;
}
/**
* Sets whether Google Analytics collection is enabled for this app on this device.
* Sets global `window['ga-disable-analyticsId'] = true;`
*
* @public
*
* @param analyticsInstance - The {@link Analytics} instance.
* @param enabled - If true, enables collection, if false, disables it.
*/
export declare function setAnalyticsCollectionEnabled(analyticsInstance: Analytics, enabled: boolean): void;
/**
* Sets the applicable end user consent state for this web app across all gtag references once
* Firebase Analytics is initialized.
*
* Use the {@link ConsentSettings} to specify individual consent type values. By default consent
* types are set to "granted".
* @public
* @param consentSettings - Maps the applicable end user consent state for gtag.js.
*/
export declare function setConsent(consentSettings: ConsentSettings): void;
/**
* Use gtag `config` command to set `screen_name`.
*
* @public
*
* @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`.
* See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}.
*
* @param analyticsInstance - The {@link Analytics} instance.
* @param screenName - Screen name to set.
*/
export declare function setCurrentScreen(analyticsInstance: Analytics, screenName: string, options?: AnalyticsCallOptions): void;
/**
* 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.
* @public
* @param customParams - Any custom params the user may pass to gtag.js.
*/
export declare function setDefaultEventParameters(customParams: CustomParams): void;
/**
* Configures Firebase Analytics to use custom `gtag` or `dataLayer` names.
* Intended to be used if `gtag.js` script has been installed on
* this page independently of Firebase Analytics, and is using non-default
* names for either the `gtag` function or for `dataLayer`.
* Must be called before calling `getAnalytics()` or it won't
* have any effect.
*
* @public
*
* @param options - Custom gtag and dataLayer names.
*/
export declare function settings(options: SettingsOptions): void;
/**
* Specifies custom options for your Firebase Analytics instance.
* You must set these before initializing `firebase.analytics()`.
* @public
*/
export declare interface SettingsOptions {
/** Sets custom name for `gtag` function. */
gtagName?: string;
/** Sets custom name for `dataLayer` array used by `gtag.js`. */
dataLayerName?: string;
}
/**
* Use gtag `config` command to set `user_id`.
*
* @public
*
* @param analyticsInstance - The {@link Analytics} instance.
* @param id - User ID to set.
*/
export declare function setUserId(analyticsInstance: Analytics, id: string | null, options?: AnalyticsCallOptions): void;
/**
* Use gtag `config` command to set all params specified.
*
* @public
*/
export declare function setUserProperties(analyticsInstance: Analytics, properties: CustomParams, options?: AnalyticsCallOptions): void;
export { }

763
node_modules/@firebase/analytics/dist/analytics.d.ts generated vendored Normal file
View file

@ -0,0 +1,763 @@
/**
* The Firebase Analytics Web SDK.
* This SDK does not work in a Node.js environment.
*
* @packageDocumentation
*/
import { FirebaseApp } from '@firebase/app';
/**
* An instance of Firebase Analytics.
* @public
*/
export declare interface Analytics {
/**
* The {@link @firebase/app#FirebaseApp} this {@link Analytics} instance is associated with.
*/
app: FirebaseApp;
}
/**
* Additional options that can be passed to Analytics method
* calls such as `logEvent`, etc.
* @public
*/
export declare interface AnalyticsCallOptions {
/**
* If true, this config or event call applies globally to all
* Google Analytics properties on the page.
*/
global: boolean;
}
/**
* {@link Analytics} instance initialization options.
* @public
*/
export declare interface AnalyticsSettings {
/**
* Params to be passed in the initial `gtag` config call during Firebase
* Analytics initialization.
*/
config?: GtagConfigParams | EventParams;
}
/**
* Consent status settings for each consent type.
* For more information, see
* {@link https://developers.google.com/tag-platform/tag-manager/templates/consent-apis
* | the GA4 reference documentation for consent state and consent types}.
* @public
*/
export declare interface ConsentSettings {
/** Enables storage, such as cookies, related to advertising */
ad_storage?: ConsentStatusString;
/** Sets consent for sending user data to Google for advertising purposes. */
ad_user_data?: ConsentStatusString;
/** Sets consent for personalized advertising. */
ad_personalization?: ConsentStatusString;
/** Enables storage, such as cookies, related to analytics (for example, visit duration) */
analytics_storage?: ConsentStatusString;
/**
* Enables storage that supports the functionality of the website or app such as language settings
*/
functionality_storage?: ConsentStatusString;
/** Enables storage related to personalization such as video recommendations */
personalization_storage?: ConsentStatusString;
/**
* Enables storage related to security such as authentication functionality, fraud prevention,
* and other user protection.
*/
security_storage?: ConsentStatusString;
[key: string]: unknown;
}
/**
* Whether a particular consent type has been granted or denied.
* @public
*/
export declare type ConsentStatusString = 'granted' | 'denied';
/**
* Standard `gtag.js` control parameters.
* For more information, see
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
* @public
*/
export declare interface ControlParams {
groups?: string | string[];
send_to?: string | string[];
event_callback?: () => void;
event_timeout?: number;
}
/**
* Standard Google Analytics currency type.
* @public
*/
export declare type Currency = string | number;
/**
* Any custom event name string not in the standard list of recommended
* event names.
* @public
*/
export declare type CustomEventName<T> = T extends EventNameString ? never : T;
/**
* Any custom params the user may pass to `gtag`.
* @public
*/
export declare interface CustomParams {
[key: string]: unknown;
}
/**
* Type for standard Google Analytics event names. `logEvent` also accepts any
* custom string and interprets it as a custom event name.
* @public
*/
export declare 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';
/**
* Standard `gtag.js` event parameters.
* For more information, see
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
* @public
*/
export declare interface EventParams {
checkout_option?: string;
checkout_step?: number;
item_id?: string;
content_type?: string;
coupon?: string;
currency?: string;
description?: string;
fatal?: boolean;
items?: Item[];
method?: string;
number?: string;
promotions?: Promotion[];
screen_name?: string;
/**
* Firebase-specific. Use to log a `screen_name` to Firebase Analytics.
*/
firebase_screen?: string;
/**
* Firebase-specific. Use to log a `screen_class` to Firebase Analytics.
*/
firebase_screen_class?: string;
search_term?: string;
shipping?: Currency;
tax?: Currency;
transaction_id?: string;
value?: number;
event_label?: string;
event_category?: string;
shipping_tier?: string;
item_list_id?: string;
item_list_name?: string;
promotion_id?: string;
promotion_name?: string;
payment_type?: string;
affiliation?: string;
page_title?: string;
page_location?: string;
page_path?: string;
[key: string]: unknown;
}
/**
* Returns an {@link Analytics} instance for the given app.
*
* @public
*
* @param app - The {@link @firebase/app#FirebaseApp} to use.
*/
export declare function getAnalytics(app?: FirebaseApp): Analytics;
/**
* Retrieves a unique Google Analytics identifier for the web client.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}.
*
* @public
*
* @param app - The {@link @firebase/app#FirebaseApp} to use.
*/
export declare function getGoogleAnalyticsClientId(analyticsInstance: Analytics): Promise<string>;
/**
* A set of common Google Analytics config settings recognized by
* `gtag.js`.
* @public
*/
export declare interface GtagConfigParams {
/**
* Whether or not a page view should be sent.
* If set to true (default), a page view is automatically sent upon initialization
* of analytics.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views }
*/
'send_page_view'?: boolean;
/**
* The title of the page.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views }
*/
'page_title'?: string;
/**
* The URL of the page.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views }
*/
'page_location'?: string;
/**
* Defaults to `auto`.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
*/
'cookie_domain'?: string;
/**
* Defaults to 63072000 (two years, in seconds).
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
*/
'cookie_expires'?: number;
/**
* Defaults to `_ga`.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
*/
'cookie_prefix'?: string;
/**
* If set to true, will update cookies on each page load.
* Defaults to true.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
*/
'cookie_update'?: boolean;
/**
* Appends additional flags to the cookie when set.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
*/
'cookie_flags'?: string;
/**
* If set to false, disables all advertising features with `gtag.js`.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features }
*/
'allow_google_signals'?: boolean;
/**
* If set to false, disables all advertising personalization with `gtag.js`.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features }
*/
'allow_ad_personalization_signals'?: boolean;
[key: string]: unknown;
}
/**
* Returns an {@link Analytics} instance for the given app.
*
* @public
*
* @param app - The {@link @firebase/app#FirebaseApp} to use.
*/
export declare function initializeAnalytics(app: FirebaseApp, options?: AnalyticsSettings): Analytics;
/**
* 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()`.
*
* @public
*
*/
export declare function isSupported(): Promise<boolean>;
/**
* Standard Google Analytics `Item` type.
* @public
*/
export declare interface Item {
item_id?: string;
item_name?: string;
item_brand?: string;
item_category?: string;
item_category2?: string;
item_category3?: string;
item_category4?: string;
item_category5?: string;
item_variant?: string;
price?: Currency;
quantity?: number;
index?: number;
coupon?: string;
item_list_name?: string;
item_list_id?: string;
discount?: Currency;
affiliation?: string;
creative_name?: string;
creative_slot?: string;
promotion_id?: string;
promotion_name?: string;
location_id?: string;
/** @deprecated Use item_brand instead. */
brand?: string;
/** @deprecated Use item_category instead. */
category?: string;
/** @deprecated Use item_id instead. */
id?: string;
/** @deprecated Use item_name instead. */
name?: string;
}
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* See
* {@link https://developers.google.com/analytics/devguides/collection/ga4/exceptions
* | Measure exceptions}.
*/
export declare function logEvent(analyticsInstance: Analytics, eventName: 'exception', eventParams?: {
description?: EventParams['description'];
fatal?: EventParams['fatal'];
[key: string]: any;
}, options?: AnalyticsCallOptions): void;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
export declare function logEvent(analyticsInstance: Analytics, eventName: 'generate_lead', eventParams?: {
value?: EventParams['value'];
currency?: EventParams['currency'];
[key: string]: any;
}, options?: AnalyticsCallOptions): void;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
export declare function logEvent(analyticsInstance: Analytics, eventName: 'login', eventParams?: {
method?: EventParams['method'];
[key: string]: any;
}, options?: AnalyticsCallOptions): void;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* See
* {@link https://developers.google.com/analytics/devguides/collection/ga4/views
* | Page views}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* See {@link https://firebase.google.com/docs/analytics/screenviews
* | Track Screenviews}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
export declare function logEvent(analyticsInstance: Analytics, eventName: 'search' | 'view_search_results', eventParams?: {
search_term?: EventParams['search_term'];
[key: string]: any;
}, options?: AnalyticsCallOptions): void;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
export declare function logEvent(analyticsInstance: Analytics, eventName: 'sign_up', eventParams?: {
method?: EventParams['method'];
[key: string]: any;
}, options?: AnalyticsCallOptions): void;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
export declare function logEvent<T extends string>(analyticsInstance: Analytics, eventName: CustomEventName<T>, eventParams?: {
[key: string]: any;
}, options?: AnalyticsCallOptions): void;
/**
* Field previously used by some Google Analytics events.
* @deprecated Use `Item` instead.
* @public
*/
export declare interface Promotion {
creative_name?: string;
creative_slot?: string;
id?: string;
name?: string;
}
/**
* Sets whether Google Analytics collection is enabled for this app on this device.
* Sets global `window['ga-disable-analyticsId'] = true;`
*
* @public
*
* @param analyticsInstance - The {@link Analytics} instance.
* @param enabled - If true, enables collection, if false, disables it.
*/
export declare function setAnalyticsCollectionEnabled(analyticsInstance: Analytics, enabled: boolean): void;
/**
* Sets the applicable end user consent state for this web app across all gtag references once
* Firebase Analytics is initialized.
*
* Use the {@link ConsentSettings} to specify individual consent type values. By default consent
* types are set to "granted".
* @public
* @param consentSettings - Maps the applicable end user consent state for gtag.js.
*/
export declare function setConsent(consentSettings: ConsentSettings): void;
/**
* Use gtag `config` command to set `screen_name`.
*
* @public
*
* @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`.
* See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}.
*
* @param analyticsInstance - The {@link Analytics} instance.
* @param screenName - Screen name to set.
*/
export declare function setCurrentScreen(analyticsInstance: Analytics, screenName: string, options?: AnalyticsCallOptions): void;
/**
* 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.
* @public
* @param customParams - Any custom params the user may pass to gtag.js.
*/
export declare function setDefaultEventParameters(customParams: CustomParams): void;
/**
* Configures Firebase Analytics to use custom `gtag` or `dataLayer` names.
* Intended to be used if `gtag.js` script has been installed on
* this page independently of Firebase Analytics, and is using non-default
* names for either the `gtag` function or for `dataLayer`.
* Must be called before calling `getAnalytics()` or it won't
* have any effect.
*
* @public
*
* @param options - Custom gtag and dataLayer names.
*/
export declare function settings(options: SettingsOptions): void;
/**
* Specifies custom options for your Firebase Analytics instance.
* You must set these before initializing `firebase.analytics()`.
* @public
*/
export declare interface SettingsOptions {
/** Sets custom name for `gtag` function. */
gtagName?: string;
/** Sets custom name for `dataLayer` array used by `gtag.js`. */
dataLayerName?: string;
}
/**
* Use gtag `config` command to set `user_id`.
*
* @public
*
* @param analyticsInstance - The {@link Analytics} instance.
* @param id - User ID to set.
*/
export declare function setUserId(analyticsInstance: Analytics, id: string | null, options?: AnalyticsCallOptions): void;
/**
* Use gtag `config` command to set all params specified.
*
* @public
*/
export declare function setUserProperties(analyticsInstance: Analytics, properties: CustomParams, options?: AnalyticsCallOptions): void;
export { }

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
{"type":"module"}

453
node_modules/@firebase/analytics/dist/esm/src/api.d.ts generated vendored Normal file
View file

@ -0,0 +1,453 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FirebaseApp } from '@firebase/app';
import { Analytics, AnalyticsCallOptions, AnalyticsSettings, ConsentSettings, CustomParams, EventNameString, EventParams } from './public-types';
import { ANALYTICS_TYPE } from './constants';
import { AnalyticsService } from './factory';
export { settings } from './factory';
declare module '@firebase/component' {
interface NameServiceMapping {
[ANALYTICS_TYPE]: AnalyticsService;
}
}
/**
* Returns an {@link Analytics} instance for the given app.
*
* @public
*
* @param app - The {@link @firebase/app#FirebaseApp} to use.
*/
export declare function getAnalytics(app?: FirebaseApp): Analytics;
/**
* Returns an {@link Analytics} instance for the given app.
*
* @public
*
* @param app - The {@link @firebase/app#FirebaseApp} to use.
*/
export declare function initializeAnalytics(app: FirebaseApp, options?: AnalyticsSettings): Analytics;
/**
* 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()`.
*
* @public
*
*/
export declare function isSupported(): Promise<boolean>;
/**
* Use gtag `config` command to set `screen_name`.
*
* @public
*
* @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`.
* See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}.
*
* @param analyticsInstance - The {@link Analytics} instance.
* @param screenName - Screen name to set.
*/
export declare function setCurrentScreen(analyticsInstance: Analytics, screenName: string, options?: AnalyticsCallOptions): void;
/**
* Retrieves a unique Google Analytics identifier for the web client.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}.
*
* @public
*
* @param app - The {@link @firebase/app#FirebaseApp} to use.
*/
export declare function getGoogleAnalyticsClientId(analyticsInstance: Analytics): Promise<string>;
/**
* Use gtag `config` command to set `user_id`.
*
* @public
*
* @param analyticsInstance - The {@link Analytics} instance.
* @param id - User ID to set.
*/
export declare function setUserId(analyticsInstance: Analytics, id: string | null, options?: AnalyticsCallOptions): void;
/**
* Use gtag `config` command to set all params specified.
*
* @public
*/
export declare function setUserProperties(analyticsInstance: Analytics, properties: CustomParams, options?: AnalyticsCallOptions): void;
/**
* Sets whether Google Analytics collection is enabled for this app on this device.
* Sets global `window['ga-disable-analyticsId'] = true;`
*
* @public
*
* @param analyticsInstance - The {@link Analytics} instance.
* @param enabled - If true, enables collection, if false, disables it.
*/
export declare function setAnalyticsCollectionEnabled(analyticsInstance: Analytics, enabled: boolean): void;
/**
* 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.
* @public
* @param customParams - Any custom params the user may pass to gtag.js.
*/
export declare function setDefaultEventParameters(customParams: CustomParams): void;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* See
* {@link https://developers.google.com/analytics/devguides/collection/ga4/exceptions
* | Measure exceptions}.
*/
export declare function logEvent(analyticsInstance: Analytics, eventName: 'exception', eventParams?: {
description?: EventParams['description'];
fatal?: EventParams['fatal'];
[key: string]: any;
}, options?: AnalyticsCallOptions): void;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
export declare function logEvent(analyticsInstance: Analytics, eventName: 'generate_lead', eventParams?: {
value?: EventParams['value'];
currency?: EventParams['currency'];
[key: string]: any;
}, options?: AnalyticsCallOptions): void;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
export declare function logEvent(analyticsInstance: Analytics, eventName: 'login', eventParams?: {
method?: EventParams['method'];
[key: string]: any;
}, options?: AnalyticsCallOptions): void;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* See
* {@link https://developers.google.com/analytics/devguides/collection/ga4/views
* | Page views}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* See {@link https://firebase.google.com/docs/analytics/screenviews
* | Track Screenviews}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
export declare function logEvent(analyticsInstance: Analytics, eventName: 'search' | 'view_search_results', eventParams?: {
search_term?: EventParams['search_term'];
[key: string]: any;
}, options?: AnalyticsCallOptions): void;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
export declare function logEvent(analyticsInstance: Analytics, eventName: 'sign_up', eventParams?: {
method?: EventParams['method'];
[key: string]: any;
}, options?: AnalyticsCallOptions): void;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
export declare function logEvent<T extends string>(analyticsInstance: Analytics, eventName: CustomEventName<T>, eventParams?: {
[key: string]: any;
}, options?: AnalyticsCallOptions): void;
/**
* Any custom event name string not in the standard list of recommended
* event names.
* @public
*/
export declare type CustomEventName<T> = T extends EventNameString ? never : T;
/**
* Sets the applicable end user consent state for this web app across all gtag references once
* Firebase Analytics is initialized.
*
* Use the {@link ConsentSettings} to specify individual consent type values. By default consent
* types are set to "granted".
* @public
* @param consentSettings - Maps the applicable end user consent state for gtag.js.
*/
export declare function setConsent(consentSettings: ConsentSettings): void;

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import '../testing/setup';

View file

@ -0,0 +1,32 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Type constant for Firebase Analytics.
*/
export declare const ANALYTICS_TYPE = "analytics";
export declare const GA_FID_KEY = "firebase_id";
export declare const ORIGIN_KEY = "origin";
export declare const FETCH_TIMEOUT_MILLIS: number;
export declare const DYNAMIC_CONFIG_URL = "https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig";
export declare const GTAG_URL = "https://www.googletagmanager.com/gtag/js";
export declare const enum GtagCommand {
EVENT = "event",
SET = "set",
CONFIG = "config",
CONSENT = "consent",
GET = "get"
}

View file

@ -0,0 +1,57 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ErrorFactory } from '@firebase/util';
export declare const enum AnalyticsError {
ALREADY_EXISTS = "already-exists",
ALREADY_INITIALIZED = "already-initialized",
ALREADY_INITIALIZED_SETTINGS = "already-initialized-settings",
INTEROP_COMPONENT_REG_FAILED = "interop-component-reg-failed",
INVALID_ANALYTICS_CONTEXT = "invalid-analytics-context",
INDEXEDDB_UNAVAILABLE = "indexeddb-unavailable",
FETCH_THROTTLE = "fetch-throttle",
CONFIG_FETCH_FAILED = "config-fetch-failed",
NO_API_KEY = "no-api-key",
NO_APP_ID = "no-app-id",
NO_CLIENT_ID = "no-client-id",
INVALID_GTAG_RESOURCE = "invalid-gtag-resource"
}
interface ErrorParams {
[AnalyticsError.ALREADY_EXISTS]: {
id: string;
};
[AnalyticsError.INTEROP_COMPONENT_REG_FAILED]: {
reason: Error;
};
[AnalyticsError.FETCH_THROTTLE]: {
throttleEndTimeMillis: number;
};
[AnalyticsError.CONFIG_FETCH_FAILED]: {
httpStatus: number;
responseMessage: string;
};
[AnalyticsError.INVALID_ANALYTICS_CONTEXT]: {
errorInfo: string;
};
[AnalyticsError.INDEXEDDB_UNAVAILABLE]: {
errorInfo: string;
};
[AnalyticsError.INVALID_GTAG_RESOURCE]: {
gtagURL: string;
};
}
export declare const ERROR_FACTORY: ErrorFactory<AnalyticsError, ErrorParams>;
export {};

View file

@ -0,0 +1,74 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { SettingsOptions, Analytics, AnalyticsSettings } from './public-types';
import { Gtag, DynamicConfig, MinimalDynamicConfig } from './types';
import { _FirebaseInstallationsInternal } from '@firebase/installations';
import { FirebaseApp, _FirebaseService } from '@firebase/app';
/**
* Analytics Service class.
*/
export declare class AnalyticsService implements Analytics, _FirebaseService {
app: FirebaseApp;
constructor(app: FirebaseApp);
_delete(): Promise<void>;
}
/**
* Maps appId to full initialization promise. Wrapped gtag calls must wait on
* all or some of these, depending on the call's `send_to` param and the status
* of the dynamic config fetches (see below).
*/
export declare let initializationPromisesMap: {
[appId: string]: Promise<string>;
};
/**
* Wrapper around gtag function that ensures FID is sent with all
* relevant event and config calls.
*/
export declare let wrappedGtagFunction: Gtag;
/**
* For testing
* @internal
*/
export declare function resetGlobalVars(newGlobalInitDone?: boolean, newInitializationPromisesMap?: {}, newDynamicPromises?: never[]): void;
/**
* For testing
* @internal
*/
export declare function getGlobalVars(): {
initializationPromisesMap: {
[appId: string]: Promise<string>;
};
dynamicConfigPromisesList: Array<Promise<DynamicConfig | MinimalDynamicConfig>>;
};
/**
* 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.
*
* @public
*
* @param options - Custom gtag and dataLayer names.
*/
export declare function settings(options: SettingsOptions): void;
/**
* Analytics instance factory.
* @internal
*/
export declare function factory(app: FirebaseApp, installations: _FirebaseInstallationsInternal, options?: AnalyticsSettings): AnalyticsService;

View file

@ -0,0 +1,85 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AnalyticsCallOptions, CustomParams, EventParams, ConsentSettings } from './public-types';
import { Gtag } from './types';
/**
* Event parameters to set on 'gtag' during initialization.
*/
export declare let defaultEventParametersForInit: CustomParams | undefined;
/**
* Logs an analytics event through the Firebase SDK.
*
* @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
* @param eventName Google Analytics event name, choose from standard list or use a custom string.
* @param eventParams Analytics event parameters.
*/
export declare function logEvent(gtagFunction: Gtag, initializationPromise: Promise<string>, eventName: string, eventParams?: EventParams, options?: AnalyticsCallOptions): Promise<void>;
/**
* Set screen_name parameter for this Google Analytics ID.
*
* @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`.
* See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}.
*
* @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
* @param screenName Screen name string to set.
*/
export declare function setCurrentScreen(gtagFunction: Gtag, initializationPromise: Promise<string>, screenName: string | null, options?: AnalyticsCallOptions): Promise<void>;
/**
* Set user_id parameter for this Google Analytics ID.
*
* @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
* @param id User ID string to set
*/
export declare function setUserId(gtagFunction: Gtag, initializationPromise: Promise<string>, id: string | null, options?: AnalyticsCallOptions): Promise<void>;
/**
* Set all other user properties other than user_id and screen_name.
*
* @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
* @param properties Map of user properties to set
*/
export declare function setUserProperties(gtagFunction: Gtag, initializationPromise: Promise<string>, properties: CustomParams, options?: AnalyticsCallOptions): Promise<void>;
/**
* Retrieves a unique Google Analytics identifier for the web client.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}.
*
* @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
*/
export declare function internalGetGoogleAnalyticsClientId(gtagFunction: Gtag, initializationPromise: Promise<string>): Promise<string>;
/**
* Set whether collection is enabled for this ID.
*
* @param enabled If true, collection is enabled for this ID.
*/
export declare function setAnalyticsCollectionEnabled(initializationPromise: Promise<string>, enabled: boolean): Promise<void>;
/**
* Consent parameters to default to during 'gtag' initialization.
*/
export declare let defaultConsentSettingsForInit: ConsentSettings | undefined;
/**
* Sets the variable {@link defaultConsentSettingsForInit} for use in the initialization of
* analytics.
*
* @param consentSettings Maps the applicable end user consent state for gtag.js.
*/
export declare function _setConsentDefaultForInit(consentSettings?: ConsentSettings): void;
/**
* Sets the variable `defaultEventParametersForInit` for use in the initialization of
* analytics.
*
* @param customParams Any custom params the user may pass to gtag.js.
*/
export declare function _setDefaultEventParametersForInit(customParams?: CustomParams): void;

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import '../testing/setup';

View file

@ -0,0 +1,72 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview Most logic is copied from packages/remote-config/src/client/retrying_client.ts
*/
import { FirebaseApp } from '@firebase/app';
import { DynamicConfig, ThrottleMetadata, MinimalDynamicConfig } from './types';
export interface AppFields {
appId: string;
apiKey: string;
measurementId?: string;
}
/**
* Backoff factor for 503 errors, which we want to be conservative about
* to avoid overloading servers. Each retry interval will be
* BASE_INTERVAL_MILLIS * LONG_RETRY_FACTOR ^ retryCount, so the second one
* will be ~30 seconds (with fuzzing).
*/
export declare const LONG_RETRY_FACTOR = 30;
/**
* Stubbable retry data storage class.
*/
declare class RetryData {
throttleMetadata: {
[appId: string]: ThrottleMetadata;
};
intervalMillis: number;
constructor(throttleMetadata?: {
[appId: string]: ThrottleMetadata;
}, intervalMillis?: number);
getThrottleMetadata(appId: string): ThrottleMetadata;
setThrottleMetadata(appId: string, metadata: ThrottleMetadata): void;
deleteThrottleMetadata(appId: string): void;
}
/**
* Fetches dynamic config from backend.
* @param app Firebase app to fetch config for.
*/
export declare function fetchDynamicConfig(appFields: AppFields): Promise<DynamicConfig>;
/**
* Fetches dynamic config from backend, retrying if failed.
* @param app Firebase app to fetch config for.
*/
export declare function fetchDynamicConfigWithRetry(app: FirebaseApp, retryData?: RetryData, timeoutMillis?: number): Promise<DynamicConfig | MinimalDynamicConfig>;
/**
* Shims a minimal AbortSignal (copied from Remote Config).
*
* <p>AbortController's AbortSignal conveniently decouples fetch timeout logic from other aspects
* of networking, such as retries. Firebase doesn't use AbortController enough to justify a
* polyfill recommendation, like we do with the Fetch API, but this minimal shim can easily be
* swapped out if/when we do.
*/
export declare class AnalyticsAbortSignal {
listeners: Array<() => void>;
addEventListener(listener: () => void): void;
abort(): void;
}
export {};

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import '../testing/setup';

View file

@ -0,0 +1,71 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/// <reference types="trusted-types" />
import { DynamicConfig, DataLayer, Gtag, MinimalDynamicConfig } from './types';
/**
* Verifies and creates a TrustedScriptURL.
*/
export declare function createGtagTrustedTypesScriptURL(url: string): string;
/**
* Makeshift polyfill for Promise.allSettled(). Resolves when all promises
* have either resolved or rejected.
*
* @param promises Array of promises to wait for.
*/
export declare function promiseAllSettled<T>(promises: Array<Promise<T>>): Promise<T[]>;
/**
* Creates a TrustedTypePolicy object that implements the rules passed as policyOptions.
*
* @param policyName A string containing the name of the policy
* @param policyOptions Object containing implementations of instance methods for TrustedTypesPolicy, see {@link https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy#instance_methods
* | the TrustedTypePolicy reference documentation}.
*/
export declare function createTrustedTypesPolicy(policyName: string, policyOptions: Partial<TrustedTypePolicyOptions>): Partial<TrustedTypePolicy> | undefined;
/**
* Inserts gtag script tag into the page to asynchronously download gtag.
* @param dataLayerName Name of datalayer (most often the default, "_dataLayer").
*/
export declare function insertScriptTag(dataLayerName: string, measurementId: string): void;
/**
* Get reference to, or create, global datalayer.
* @param dataLayerName Name of datalayer (most often the default, "_dataLayer").
*/
export declare function getOrCreateDataLayer(dataLayerName: string): DataLayer;
/**
* Creates global gtag function or wraps existing one if found.
* This wrapped function attaches Firebase instance ID (FID) to gtag 'config' and
* 'event' calls that belong to the GAID associated with this Firebase instance.
*
* @param initializationPromisesMap Map of appIds to their initialization promises.
* @param dynamicConfigPromisesList Array of dynamic config fetch promises.
* @param measurementIdToAppId Map of GA measurementIDs to corresponding Firebase appId.
* @param dataLayerName Name of global GA datalayer array.
* @param gtagFunctionName Name of global gtag function ("gtag" if not user-specified).
*/
export declare function wrapOrCreateGtag(initializationPromisesMap: {
[appId: string]: Promise<string>;
}, dynamicConfigPromisesList: Array<Promise<DynamicConfig | MinimalDynamicConfig>>, measurementIdToAppId: {
[measurementId: string]: string;
}, dataLayerName: string, gtagFunctionName: string): {
gtagCore: Gtag;
wrappedGtag: Gtag;
};
/**
* Returns the script tag in the DOM matching both the gtag url pattern
* and the provided data layer name.
*/
export declare function findGtagScriptOnPage(dataLayerName: string): HTMLScriptElement | null;

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import '../testing/setup';

View file

@ -0,0 +1,14 @@
/**
* The Firebase Analytics Web SDK.
* This SDK does not work in a Node.js environment.
*
* @packageDocumentation
*/
import '@firebase/installations';
declare global {
interface Window {
[key: string]: unknown;
}
}
export * from './api';
export * from './public-types';

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import '../testing/setup';

View file

@ -0,0 +1,36 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { DynamicConfig, Gtag, MinimalDynamicConfig } from './types';
import { _FirebaseInstallationsInternal } from '@firebase/installations';
import { FirebaseApp } from '@firebase/app';
import { AnalyticsSettings } from './public-types';
/**
* Initialize the analytics instance in gtag.js by calling config command with fid.
*
* NOTE: We combine analytics initialization and setting fid together because we want fid to be
* part of the `page_view` event that's sent during the initialization
* @param app Firebase app
* @param gtagCore The gtag function that's not wrapped.
* @param dynamicConfigPromisesList Array of all dynamic config promises.
* @param measurementIdToAppId Maps measurementID to appID.
* @param installations _FirebaseInstallationsInternal instance.
*
* @returns Measurement ID.
*/
export declare function _initializeAnalytics(app: FirebaseApp, dynamicConfigPromisesList: Array<Promise<DynamicConfig | MinimalDynamicConfig>>, measurementIdToAppId: {
[key: string]: string;
}, installations: _FirebaseInstallationsInternal, gtagCore: Gtag, dataLayerName: string, options?: AnalyticsSettings): Promise<string>;

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import '../testing/setup';

View file

@ -0,0 +1,18 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Logger } from '@firebase/logger';
export declare const logger: Logger;

View file

@ -0,0 +1,282 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FirebaseApp } from '@firebase/app';
/**
* A set of common Google Analytics config settings recognized by
* `gtag.js`.
* @public
*/
export interface GtagConfigParams {
/**
* Whether or not a page view should be sent.
* If set to true (default), a page view is automatically sent upon initialization
* of analytics.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views }
*/
'send_page_view'?: boolean;
/**
* The title of the page.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views }
*/
'page_title'?: string;
/**
* The URL of the page.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views }
*/
'page_location'?: string;
/**
* Defaults to `auto`.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
*/
'cookie_domain'?: string;
/**
* Defaults to 63072000 (two years, in seconds).
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
*/
'cookie_expires'?: number;
/**
* Defaults to `_ga`.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
*/
'cookie_prefix'?: string;
/**
* If set to true, will update cookies on each page load.
* Defaults to true.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
*/
'cookie_update'?: boolean;
/**
* Appends additional flags to the cookie when set.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
*/
'cookie_flags'?: string;
/**
* If set to false, disables all advertising features with `gtag.js`.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features }
*/
'allow_google_signals'?: boolean;
/**
* If set to false, disables all advertising personalization with `gtag.js`.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features }
*/
'allow_ad_personalization_signals'?: boolean;
[key: string]: unknown;
}
/**
* {@link Analytics} instance initialization options.
* @public
*/
export interface AnalyticsSettings {
/**
* Params to be passed in the initial `gtag` config call during Firebase
* Analytics initialization.
*/
config?: GtagConfigParams | EventParams;
}
/**
* Additional options that can be passed to Analytics method
* calls such as `logEvent`, etc.
* @public
*/
export interface AnalyticsCallOptions {
/**
* If true, this config or event call applies globally to all
* Google Analytics properties on the page.
*/
global: boolean;
}
/**
* An instance of Firebase Analytics.
* @public
*/
export interface Analytics {
/**
* The {@link @firebase/app#FirebaseApp} this {@link Analytics} instance is associated with.
*/
app: FirebaseApp;
}
/**
* Specifies custom options for your Firebase Analytics instance.
* You must set these before initializing `firebase.analytics()`.
* @public
*/
export interface SettingsOptions {
/** Sets custom name for `gtag` function. */
gtagName?: string;
/** Sets custom name for `dataLayer` array used by `gtag.js`. */
dataLayerName?: string;
}
/**
* Any custom params the user may pass to `gtag`.
* @public
*/
export interface CustomParams {
[key: string]: unknown;
}
/**
* Type for standard Google Analytics event names. `logEvent` also accepts any
* custom string and interprets it as a custom event name.
* @public
*/
export declare 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';
/**
* Standard Google Analytics currency type.
* @public
*/
export declare type Currency = string | number;
/**
* Standard Google Analytics `Item` type.
* @public
*/
export interface Item {
item_id?: string;
item_name?: string;
item_brand?: string;
item_category?: string;
item_category2?: string;
item_category3?: string;
item_category4?: string;
item_category5?: string;
item_variant?: string;
price?: Currency;
quantity?: number;
index?: number;
coupon?: string;
item_list_name?: string;
item_list_id?: string;
discount?: Currency;
affiliation?: string;
creative_name?: string;
creative_slot?: string;
promotion_id?: string;
promotion_name?: string;
location_id?: string;
/** @deprecated Use item_brand instead. */
brand?: string;
/** @deprecated Use item_category instead. */
category?: string;
/** @deprecated Use item_id instead. */
id?: string;
/** @deprecated Use item_name instead. */
name?: string;
}
/**
* Field previously used by some Google Analytics events.
* @deprecated Use `Item` instead.
* @public
*/
export interface Promotion {
creative_name?: string;
creative_slot?: string;
id?: string;
name?: string;
}
/**
* Standard `gtag.js` control parameters.
* For more information, see
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
* @public
*/
export interface ControlParams {
groups?: string | string[];
send_to?: string | string[];
event_callback?: () => void;
event_timeout?: number;
}
/**
* Standard `gtag.js` event parameters.
* For more information, see
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
* @public
*/
export interface EventParams {
checkout_option?: string;
checkout_step?: number;
item_id?: string;
content_type?: string;
coupon?: string;
currency?: string;
description?: string;
fatal?: boolean;
items?: Item[];
method?: string;
number?: string;
promotions?: Promotion[];
screen_name?: string;
/**
* Firebase-specific. Use to log a `screen_name` to Firebase Analytics.
*/
firebase_screen?: string;
/**
* Firebase-specific. Use to log a `screen_class` to Firebase Analytics.
*/
firebase_screen_class?: string;
search_term?: string;
shipping?: Currency;
tax?: Currency;
transaction_id?: string;
value?: number;
event_label?: string;
event_category?: string;
shipping_tier?: string;
item_list_id?: string;
item_list_name?: string;
promotion_id?: string;
promotion_name?: string;
payment_type?: string;
affiliation?: string;
page_title?: string;
page_location?: string;
page_path?: string;
[key: string]: unknown;
}
/**
* Consent status settings for each consent type.
* For more information, see
* {@link https://developers.google.com/tag-platform/tag-manager/templates/consent-apis
* | the GA4 reference documentation for consent state and consent types}.
* @public
*/
export interface ConsentSettings {
/** Enables storage, such as cookies, related to advertising */
ad_storage?: ConsentStatusString;
/** Sets consent for sending user data to Google for advertising purposes. */
ad_user_data?: ConsentStatusString;
/** Sets consent for personalized advertising. */
ad_personalization?: ConsentStatusString;
/** Enables storage, such as cookies, related to analytics (for example, visit duration) */
analytics_storage?: ConsentStatusString;
/**
* Enables storage that supports the functionality of the website or app such as language settings
*/
functionality_storage?: ConsentStatusString;
/** Enables storage related to personalization such as video recommendations */
personalization_storage?: ConsentStatusString;
/**
* Enables storage related to security such as authentication functionality, fraud prevention,
* and other user protection.
*/
security_storage?: ConsentStatusString;
[key: string]: unknown;
}
/**
* Whether a particular consent type has been granted or denied.
* @public
*/
export declare type ConsentStatusString = 'granted' | 'denied';

View file

@ -0,0 +1,55 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ControlParams, EventParams, CustomParams, ConsentSettings } from './public-types';
/**
* Encapsulates metadata concerning throttled fetch requests.
*/
export interface ThrottleMetadata {
backoffCount: number;
throttleEndTimeMillis: number;
}
/**
* Dynamic configuration fetched from server.
* See https://firebase.google.com/docs/reference/firebase-management/rest/v1beta1/projects.webApps/getConfig
*/
export interface DynamicConfig {
projectId: string;
appId: string;
databaseURL: string;
storageBucket: string;
locationId: string;
apiKey: string;
authDomain: string;
messagingSenderId: string;
measurementId: string;
}
export interface MinimalDynamicConfig {
appId: string;
measurementId: string;
}
/**
* Standard `gtag` function provided by gtag.js.
*/
export interface Gtag {
(command: 'config', targetId: string, config?: ControlParams | EventParams | CustomParams): void;
(command: 'set', config: CustomParams): void;
(command: 'event', eventName: string, eventParams?: ControlParams | EventParams | CustomParams): void;
(command: 'consent', subCommand: 'default' | 'update', consentSettings: ConsentSettings): void;
(command: 'get', measurementId: string, fieldName: string, callback: (...args: unknown[]) => void): void;
(command: string, ...args: unknown[]): void;
}
export declare type DataLayer = IArguments[];

View file

@ -0,0 +1,29 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FirebaseApp } from '@firebase/app';
import { _FirebaseInstallationsInternal } from '@firebase/installations';
export declare function getFakeApp(fakeAppParams?: {
appId?: string;
apiKey?: string;
measurementId?: string;
}): FirebaseApp;
export declare function getFakeInstallations(fid?: string, onFidResolve?: Function): _FirebaseInstallationsInternal;
export declare function getFullApp(fakeAppParams?: {
appId?: string;
apiKey?: string;
measurementId?: string;
}): FirebaseApp;

View file

@ -0,0 +1 @@
export declare function removeGtagScripts(): void;

View file

@ -0,0 +1,18 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import '@firebase/installations';
import '../setup';

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export {};

1286
node_modules/@firebase/analytics/dist/index.cjs.js generated vendored Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

453
node_modules/@firebase/analytics/dist/src/api.d.ts generated vendored Normal file
View file

@ -0,0 +1,453 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FirebaseApp } from '@firebase/app';
import { Analytics, AnalyticsCallOptions, AnalyticsSettings, ConsentSettings, CustomParams, EventNameString, EventParams } from './public-types';
import { ANALYTICS_TYPE } from './constants';
import { AnalyticsService } from './factory';
export { settings } from './factory';
declare module '@firebase/component' {
interface NameServiceMapping {
[ANALYTICS_TYPE]: AnalyticsService;
}
}
/**
* Returns an {@link Analytics} instance for the given app.
*
* @public
*
* @param app - The {@link @firebase/app#FirebaseApp} to use.
*/
export declare function getAnalytics(app?: FirebaseApp): Analytics;
/**
* Returns an {@link Analytics} instance for the given app.
*
* @public
*
* @param app - The {@link @firebase/app#FirebaseApp} to use.
*/
export declare function initializeAnalytics(app: FirebaseApp, options?: AnalyticsSettings): Analytics;
/**
* 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()`.
*
* @public
*
*/
export declare function isSupported(): Promise<boolean>;
/**
* Use gtag `config` command to set `screen_name`.
*
* @public
*
* @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`.
* See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}.
*
* @param analyticsInstance - The {@link Analytics} instance.
* @param screenName - Screen name to set.
*/
export declare function setCurrentScreen(analyticsInstance: Analytics, screenName: string, options?: AnalyticsCallOptions): void;
/**
* Retrieves a unique Google Analytics identifier for the web client.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}.
*
* @public
*
* @param app - The {@link @firebase/app#FirebaseApp} to use.
*/
export declare function getGoogleAnalyticsClientId(analyticsInstance: Analytics): Promise<string>;
/**
* Use gtag `config` command to set `user_id`.
*
* @public
*
* @param analyticsInstance - The {@link Analytics} instance.
* @param id - User ID to set.
*/
export declare function setUserId(analyticsInstance: Analytics, id: string | null, options?: AnalyticsCallOptions): void;
/**
* Use gtag `config` command to set all params specified.
*
* @public
*/
export declare function setUserProperties(analyticsInstance: Analytics, properties: CustomParams, options?: AnalyticsCallOptions): void;
/**
* Sets whether Google Analytics collection is enabled for this app on this device.
* Sets global `window['ga-disable-analyticsId'] = true;`
*
* @public
*
* @param analyticsInstance - The {@link Analytics} instance.
* @param enabled - If true, enables collection, if false, disables it.
*/
export declare function setAnalyticsCollectionEnabled(analyticsInstance: Analytics, enabled: boolean): void;
/**
* 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.
* @public
* @param customParams - Any custom params the user may pass to gtag.js.
*/
export declare function setDefaultEventParameters(customParams: CustomParams): void;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* See
* {@link https://developers.google.com/analytics/devguides/collection/ga4/exceptions
* | Measure exceptions}.
*/
export declare function logEvent(analyticsInstance: Analytics, eventName: 'exception', eventParams?: {
description?: EventParams['description'];
fatal?: EventParams['fatal'];
[key: string]: any;
}, options?: AnalyticsCallOptions): void;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
export declare function logEvent(analyticsInstance: Analytics, eventName: 'generate_lead', eventParams?: {
value?: EventParams['value'];
currency?: EventParams['currency'];
[key: string]: any;
}, options?: AnalyticsCallOptions): void;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
export declare function logEvent(analyticsInstance: Analytics, eventName: 'login', eventParams?: {
method?: EventParams['method'];
[key: string]: any;
}, options?: AnalyticsCallOptions): void;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* See
* {@link https://developers.google.com/analytics/devguides/collection/ga4/views
* | Page views}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* See {@link https://firebase.google.com/docs/analytics/screenviews
* | Track Screenviews}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
export declare function logEvent(analyticsInstance: Analytics, eventName: 'search' | 'view_search_results', eventParams?: {
search_term?: EventParams['search_term'];
[key: string]: any;
}, options?: AnalyticsCallOptions): void;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
export declare function logEvent(analyticsInstance: Analytics, eventName: 'sign_up', eventParams?: {
method?: EventParams['method'];
[key: string]: any;
}, options?: AnalyticsCallOptions): void;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
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;
/**
* Sends a Google Analytics event with given `eventParams`. This method
* automatically associates this logged event with this Firebase web
* app instance on this device.
* @public
* List of recommended event parameters can be found in
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
*/
export declare function logEvent<T extends string>(analyticsInstance: Analytics, eventName: CustomEventName<T>, eventParams?: {
[key: string]: any;
}, options?: AnalyticsCallOptions): void;
/**
* Any custom event name string not in the standard list of recommended
* event names.
* @public
*/
export declare type CustomEventName<T> = T extends EventNameString ? never : T;
/**
* Sets the applicable end user consent state for this web app across all gtag references once
* Firebase Analytics is initialized.
*
* Use the {@link ConsentSettings} to specify individual consent type values. By default consent
* types are set to "granted".
* @public
* @param consentSettings - Maps the applicable end user consent state for gtag.js.
*/
export declare function setConsent(consentSettings: ConsentSettings): void;

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import '../testing/setup';

View file

@ -0,0 +1,32 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Type constant for Firebase Analytics.
*/
export declare const ANALYTICS_TYPE = "analytics";
export declare const GA_FID_KEY = "firebase_id";
export declare const ORIGIN_KEY = "origin";
export declare const FETCH_TIMEOUT_MILLIS: number;
export declare const DYNAMIC_CONFIG_URL = "https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig";
export declare const GTAG_URL = "https://www.googletagmanager.com/gtag/js";
export declare const enum GtagCommand {
EVENT = "event",
SET = "set",
CONFIG = "config",
CONSENT = "consent",
GET = "get"
}

57
node_modules/@firebase/analytics/dist/src/errors.d.ts generated vendored Normal file
View file

@ -0,0 +1,57 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ErrorFactory } from '@firebase/util';
export declare const enum AnalyticsError {
ALREADY_EXISTS = "already-exists",
ALREADY_INITIALIZED = "already-initialized",
ALREADY_INITIALIZED_SETTINGS = "already-initialized-settings",
INTEROP_COMPONENT_REG_FAILED = "interop-component-reg-failed",
INVALID_ANALYTICS_CONTEXT = "invalid-analytics-context",
INDEXEDDB_UNAVAILABLE = "indexeddb-unavailable",
FETCH_THROTTLE = "fetch-throttle",
CONFIG_FETCH_FAILED = "config-fetch-failed",
NO_API_KEY = "no-api-key",
NO_APP_ID = "no-app-id",
NO_CLIENT_ID = "no-client-id",
INVALID_GTAG_RESOURCE = "invalid-gtag-resource"
}
interface ErrorParams {
[AnalyticsError.ALREADY_EXISTS]: {
id: string;
};
[AnalyticsError.INTEROP_COMPONENT_REG_FAILED]: {
reason: Error;
};
[AnalyticsError.FETCH_THROTTLE]: {
throttleEndTimeMillis: number;
};
[AnalyticsError.CONFIG_FETCH_FAILED]: {
httpStatus: number;
responseMessage: string;
};
[AnalyticsError.INVALID_ANALYTICS_CONTEXT]: {
errorInfo: string;
};
[AnalyticsError.INDEXEDDB_UNAVAILABLE]: {
errorInfo: string;
};
[AnalyticsError.INVALID_GTAG_RESOURCE]: {
gtagURL: string;
};
}
export declare const ERROR_FACTORY: ErrorFactory<AnalyticsError, ErrorParams>;
export {};

74
node_modules/@firebase/analytics/dist/src/factory.d.ts generated vendored Normal file
View file

@ -0,0 +1,74 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { SettingsOptions, Analytics, AnalyticsSettings } from './public-types';
import { Gtag, DynamicConfig, MinimalDynamicConfig } from './types';
import { _FirebaseInstallationsInternal } from '@firebase/installations';
import { FirebaseApp, _FirebaseService } from '@firebase/app';
/**
* Analytics Service class.
*/
export declare class AnalyticsService implements Analytics, _FirebaseService {
app: FirebaseApp;
constructor(app: FirebaseApp);
_delete(): Promise<void>;
}
/**
* Maps appId to full initialization promise. Wrapped gtag calls must wait on
* all or some of these, depending on the call's `send_to` param and the status
* of the dynamic config fetches (see below).
*/
export declare let initializationPromisesMap: {
[appId: string]: Promise<string>;
};
/**
* Wrapper around gtag function that ensures FID is sent with all
* relevant event and config calls.
*/
export declare let wrappedGtagFunction: Gtag;
/**
* For testing
* @internal
*/
export declare function resetGlobalVars(newGlobalInitDone?: boolean, newInitializationPromisesMap?: {}, newDynamicPromises?: never[]): void;
/**
* For testing
* @internal
*/
export declare function getGlobalVars(): {
initializationPromisesMap: {
[appId: string]: Promise<string>;
};
dynamicConfigPromisesList: Array<Promise<DynamicConfig | MinimalDynamicConfig>>;
};
/**
* 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.
*
* @public
*
* @param options - Custom gtag and dataLayer names.
*/
export declare function settings(options: SettingsOptions): void;
/**
* Analytics instance factory.
* @internal
*/
export declare function factory(app: FirebaseApp, installations: _FirebaseInstallationsInternal, options?: AnalyticsSettings): AnalyticsService;

View file

@ -0,0 +1,85 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AnalyticsCallOptions, CustomParams, EventParams, ConsentSettings } from './public-types';
import { Gtag } from './types';
/**
* Event parameters to set on 'gtag' during initialization.
*/
export declare let defaultEventParametersForInit: CustomParams | undefined;
/**
* Logs an analytics event through the Firebase SDK.
*
* @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
* @param eventName Google Analytics event name, choose from standard list or use a custom string.
* @param eventParams Analytics event parameters.
*/
export declare function logEvent(gtagFunction: Gtag, initializationPromise: Promise<string>, eventName: string, eventParams?: EventParams, options?: AnalyticsCallOptions): Promise<void>;
/**
* Set screen_name parameter for this Google Analytics ID.
*
* @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`.
* See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}.
*
* @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
* @param screenName Screen name string to set.
*/
export declare function setCurrentScreen(gtagFunction: Gtag, initializationPromise: Promise<string>, screenName: string | null, options?: AnalyticsCallOptions): Promise<void>;
/**
* Set user_id parameter for this Google Analytics ID.
*
* @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
* @param id User ID string to set
*/
export declare function setUserId(gtagFunction: Gtag, initializationPromise: Promise<string>, id: string | null, options?: AnalyticsCallOptions): Promise<void>;
/**
* Set all other user properties other than user_id and screen_name.
*
* @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
* @param properties Map of user properties to set
*/
export declare function setUserProperties(gtagFunction: Gtag, initializationPromise: Promise<string>, properties: CustomParams, options?: AnalyticsCallOptions): Promise<void>;
/**
* Retrieves a unique Google Analytics identifier for the web client.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}.
*
* @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
*/
export declare function internalGetGoogleAnalyticsClientId(gtagFunction: Gtag, initializationPromise: Promise<string>): Promise<string>;
/**
* Set whether collection is enabled for this ID.
*
* @param enabled If true, collection is enabled for this ID.
*/
export declare function setAnalyticsCollectionEnabled(initializationPromise: Promise<string>, enabled: boolean): Promise<void>;
/**
* Consent parameters to default to during 'gtag' initialization.
*/
export declare let defaultConsentSettingsForInit: ConsentSettings | undefined;
/**
* Sets the variable {@link defaultConsentSettingsForInit} for use in the initialization of
* analytics.
*
* @param consentSettings Maps the applicable end user consent state for gtag.js.
*/
export declare function _setConsentDefaultForInit(consentSettings?: ConsentSettings): void;
/**
* Sets the variable `defaultEventParametersForInit` for use in the initialization of
* analytics.
*
* @param customParams Any custom params the user may pass to gtag.js.
*/
export declare function _setDefaultEventParametersForInit(customParams?: CustomParams): void;

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import '../testing/setup';

View file

@ -0,0 +1,72 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview Most logic is copied from packages/remote-config/src/client/retrying_client.ts
*/
import { FirebaseApp } from '@firebase/app';
import { DynamicConfig, ThrottleMetadata, MinimalDynamicConfig } from './types';
export interface AppFields {
appId: string;
apiKey: string;
measurementId?: string;
}
/**
* Backoff factor for 503 errors, which we want to be conservative about
* to avoid overloading servers. Each retry interval will be
* BASE_INTERVAL_MILLIS * LONG_RETRY_FACTOR ^ retryCount, so the second one
* will be ~30 seconds (with fuzzing).
*/
export declare const LONG_RETRY_FACTOR = 30;
/**
* Stubbable retry data storage class.
*/
declare class RetryData {
throttleMetadata: {
[appId: string]: ThrottleMetadata;
};
intervalMillis: number;
constructor(throttleMetadata?: {
[appId: string]: ThrottleMetadata;
}, intervalMillis?: number);
getThrottleMetadata(appId: string): ThrottleMetadata;
setThrottleMetadata(appId: string, metadata: ThrottleMetadata): void;
deleteThrottleMetadata(appId: string): void;
}
/**
* Fetches dynamic config from backend.
* @param app Firebase app to fetch config for.
*/
export declare function fetchDynamicConfig(appFields: AppFields): Promise<DynamicConfig>;
/**
* Fetches dynamic config from backend, retrying if failed.
* @param app Firebase app to fetch config for.
*/
export declare function fetchDynamicConfigWithRetry(app: FirebaseApp, retryData?: RetryData, timeoutMillis?: number): Promise<DynamicConfig | MinimalDynamicConfig>;
/**
* Shims a minimal AbortSignal (copied from Remote Config).
*
* <p>AbortController's AbortSignal conveniently decouples fetch timeout logic from other aspects
* of networking, such as retries. Firebase doesn't use AbortController enough to justify a
* polyfill recommendation, like we do with the Fetch API, but this minimal shim can easily be
* swapped out if/when we do.
*/
export declare class AnalyticsAbortSignal {
listeners: Array<() => void>;
addEventListener(listener: () => void): void;
abort(): void;
}
export {};

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import '../testing/setup';

71
node_modules/@firebase/analytics/dist/src/helpers.d.ts generated vendored Normal file
View file

@ -0,0 +1,71 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/// <reference types="trusted-types" />
import { DynamicConfig, DataLayer, Gtag, MinimalDynamicConfig } from './types';
/**
* Verifies and creates a TrustedScriptURL.
*/
export declare function createGtagTrustedTypesScriptURL(url: string): string;
/**
* Makeshift polyfill for Promise.allSettled(). Resolves when all promises
* have either resolved or rejected.
*
* @param promises Array of promises to wait for.
*/
export declare function promiseAllSettled<T>(promises: Array<Promise<T>>): Promise<T[]>;
/**
* Creates a TrustedTypePolicy object that implements the rules passed as policyOptions.
*
* @param policyName A string containing the name of the policy
* @param policyOptions Object containing implementations of instance methods for TrustedTypesPolicy, see {@link https://developer.mozilla.org/en-US/docs/Web/API/TrustedTypePolicy#instance_methods
* | the TrustedTypePolicy reference documentation}.
*/
export declare function createTrustedTypesPolicy(policyName: string, policyOptions: Partial<TrustedTypePolicyOptions>): Partial<TrustedTypePolicy> | undefined;
/**
* Inserts gtag script tag into the page to asynchronously download gtag.
* @param dataLayerName Name of datalayer (most often the default, "_dataLayer").
*/
export declare function insertScriptTag(dataLayerName: string, measurementId: string): void;
/**
* Get reference to, or create, global datalayer.
* @param dataLayerName Name of datalayer (most often the default, "_dataLayer").
*/
export declare function getOrCreateDataLayer(dataLayerName: string): DataLayer;
/**
* Creates global gtag function or wraps existing one if found.
* This wrapped function attaches Firebase instance ID (FID) to gtag 'config' and
* 'event' calls that belong to the GAID associated with this Firebase instance.
*
* @param initializationPromisesMap Map of appIds to their initialization promises.
* @param dynamicConfigPromisesList Array of dynamic config fetch promises.
* @param measurementIdToAppId Map of GA measurementIDs to corresponding Firebase appId.
* @param dataLayerName Name of global GA datalayer array.
* @param gtagFunctionName Name of global gtag function ("gtag" if not user-specified).
*/
export declare function wrapOrCreateGtag(initializationPromisesMap: {
[appId: string]: Promise<string>;
}, dynamicConfigPromisesList: Array<Promise<DynamicConfig | MinimalDynamicConfig>>, measurementIdToAppId: {
[measurementId: string]: string;
}, dataLayerName: string, gtagFunctionName: string): {
gtagCore: Gtag;
wrappedGtag: Gtag;
};
/**
* Returns the script tag in the DOM matching both the gtag url pattern
* and the provided data layer name.
*/
export declare function findGtagScriptOnPage(dataLayerName: string): HTMLScriptElement | null;

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import '../testing/setup';

14
node_modules/@firebase/analytics/dist/src/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,14 @@
/**
* The Firebase Analytics Web SDK.
* This SDK does not work in a Node.js environment.
*
* @packageDocumentation
*/
import '@firebase/installations';
declare global {
interface Window {
[key: string]: unknown;
}
}
export * from './api';
export * from './public-types';

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import '../testing/setup';

View file

@ -0,0 +1,36 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { DynamicConfig, Gtag, MinimalDynamicConfig } from './types';
import { _FirebaseInstallationsInternal } from '@firebase/installations';
import { FirebaseApp } from '@firebase/app';
import { AnalyticsSettings } from './public-types';
/**
* Initialize the analytics instance in gtag.js by calling config command with fid.
*
* NOTE: We combine analytics initialization and setting fid together because we want fid to be
* part of the `page_view` event that's sent during the initialization
* @param app Firebase app
* @param gtagCore The gtag function that's not wrapped.
* @param dynamicConfigPromisesList Array of all dynamic config promises.
* @param measurementIdToAppId Maps measurementID to appID.
* @param installations _FirebaseInstallationsInternal instance.
*
* @returns Measurement ID.
*/
export declare function _initializeAnalytics(app: FirebaseApp, dynamicConfigPromisesList: Array<Promise<DynamicConfig | MinimalDynamicConfig>>, measurementIdToAppId: {
[key: string]: string;
}, installations: _FirebaseInstallationsInternal, gtagCore: Gtag, dataLayerName: string, options?: AnalyticsSettings): Promise<string>;

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import '../testing/setup';

18
node_modules/@firebase/analytics/dist/src/logger.d.ts generated vendored Normal file
View file

@ -0,0 +1,18 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Logger } from '@firebase/logger';
export declare const logger: Logger;

View file

@ -0,0 +1,282 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FirebaseApp } from '@firebase/app';
/**
* A set of common Google Analytics config settings recognized by
* `gtag.js`.
* @public
*/
export interface GtagConfigParams {
/**
* Whether or not a page view should be sent.
* If set to true (default), a page view is automatically sent upon initialization
* of analytics.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views }
*/
'send_page_view'?: boolean;
/**
* The title of the page.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views }
*/
'page_title'?: string;
/**
* The URL of the page.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views }
*/
'page_location'?: string;
/**
* Defaults to `auto`.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
*/
'cookie_domain'?: string;
/**
* Defaults to 63072000 (two years, in seconds).
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
*/
'cookie_expires'?: number;
/**
* Defaults to `_ga`.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
*/
'cookie_prefix'?: string;
/**
* If set to true, will update cookies on each page load.
* Defaults to true.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
*/
'cookie_update'?: boolean;
/**
* Appends additional flags to the cookie when set.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
*/
'cookie_flags'?: string;
/**
* If set to false, disables all advertising features with `gtag.js`.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features }
*/
'allow_google_signals'?: boolean;
/**
* If set to false, disables all advertising personalization with `gtag.js`.
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features }
*/
'allow_ad_personalization_signals'?: boolean;
[key: string]: unknown;
}
/**
* {@link Analytics} instance initialization options.
* @public
*/
export interface AnalyticsSettings {
/**
* Params to be passed in the initial `gtag` config call during Firebase
* Analytics initialization.
*/
config?: GtagConfigParams | EventParams;
}
/**
* Additional options that can be passed to Analytics method
* calls such as `logEvent`, etc.
* @public
*/
export interface AnalyticsCallOptions {
/**
* If true, this config or event call applies globally to all
* Google Analytics properties on the page.
*/
global: boolean;
}
/**
* An instance of Firebase Analytics.
* @public
*/
export interface Analytics {
/**
* The {@link @firebase/app#FirebaseApp} this {@link Analytics} instance is associated with.
*/
app: FirebaseApp;
}
/**
* Specifies custom options for your Firebase Analytics instance.
* You must set these before initializing `firebase.analytics()`.
* @public
*/
export interface SettingsOptions {
/** Sets custom name for `gtag` function. */
gtagName?: string;
/** Sets custom name for `dataLayer` array used by `gtag.js`. */
dataLayerName?: string;
}
/**
* Any custom params the user may pass to `gtag`.
* @public
*/
export interface CustomParams {
[key: string]: unknown;
}
/**
* Type for standard Google Analytics event names. `logEvent` also accepts any
* custom string and interprets it as a custom event name.
* @public
*/
export declare 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';
/**
* Standard Google Analytics currency type.
* @public
*/
export declare type Currency = string | number;
/**
* Standard Google Analytics `Item` type.
* @public
*/
export interface Item {
item_id?: string;
item_name?: string;
item_brand?: string;
item_category?: string;
item_category2?: string;
item_category3?: string;
item_category4?: string;
item_category5?: string;
item_variant?: string;
price?: Currency;
quantity?: number;
index?: number;
coupon?: string;
item_list_name?: string;
item_list_id?: string;
discount?: Currency;
affiliation?: string;
creative_name?: string;
creative_slot?: string;
promotion_id?: string;
promotion_name?: string;
location_id?: string;
/** @deprecated Use item_brand instead. */
brand?: string;
/** @deprecated Use item_category instead. */
category?: string;
/** @deprecated Use item_id instead. */
id?: string;
/** @deprecated Use item_name instead. */
name?: string;
}
/**
* Field previously used by some Google Analytics events.
* @deprecated Use `Item` instead.
* @public
*/
export interface Promotion {
creative_name?: string;
creative_slot?: string;
id?: string;
name?: string;
}
/**
* Standard `gtag.js` control parameters.
* For more information, see
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
* @public
*/
export interface ControlParams {
groups?: string | string[];
send_to?: string | string[];
event_callback?: () => void;
event_timeout?: number;
}
/**
* Standard `gtag.js` event parameters.
* For more information, see
* {@link https://developers.google.com/gtagjs/reference/ga4-events
* | the GA4 reference documentation}.
* @public
*/
export interface EventParams {
checkout_option?: string;
checkout_step?: number;
item_id?: string;
content_type?: string;
coupon?: string;
currency?: string;
description?: string;
fatal?: boolean;
items?: Item[];
method?: string;
number?: string;
promotions?: Promotion[];
screen_name?: string;
/**
* Firebase-specific. Use to log a `screen_name` to Firebase Analytics.
*/
firebase_screen?: string;
/**
* Firebase-specific. Use to log a `screen_class` to Firebase Analytics.
*/
firebase_screen_class?: string;
search_term?: string;
shipping?: Currency;
tax?: Currency;
transaction_id?: string;
value?: number;
event_label?: string;
event_category?: string;
shipping_tier?: string;
item_list_id?: string;
item_list_name?: string;
promotion_id?: string;
promotion_name?: string;
payment_type?: string;
affiliation?: string;
page_title?: string;
page_location?: string;
page_path?: string;
[key: string]: unknown;
}
/**
* Consent status settings for each consent type.
* For more information, see
* {@link https://developers.google.com/tag-platform/tag-manager/templates/consent-apis
* | the GA4 reference documentation for consent state and consent types}.
* @public
*/
export interface ConsentSettings {
/** Enables storage, such as cookies, related to advertising */
ad_storage?: ConsentStatusString;
/** Sets consent for sending user data to Google for advertising purposes. */
ad_user_data?: ConsentStatusString;
/** Sets consent for personalized advertising. */
ad_personalization?: ConsentStatusString;
/** Enables storage, such as cookies, related to analytics (for example, visit duration) */
analytics_storage?: ConsentStatusString;
/**
* Enables storage that supports the functionality of the website or app such as language settings
*/
functionality_storage?: ConsentStatusString;
/** Enables storage related to personalization such as video recommendations */
personalization_storage?: ConsentStatusString;
/**
* Enables storage related to security such as authentication functionality, fraud prevention,
* and other user protection.
*/
security_storage?: ConsentStatusString;
[key: string]: unknown;
}
/**
* Whether a particular consent type has been granted or denied.
* @public
*/
export declare type ConsentStatusString = 'granted' | 'denied';

View file

@ -0,0 +1,11 @@
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
// It should be published with your NPM package. It should not be tracked by Git.
{
"tsdocVersion": "0.12",
"toolPackages": [
{
"packageName": "@microsoft/api-extractor",
"packageVersion": "0.1.2"
}
]
}

55
node_modules/@firebase/analytics/dist/src/types.d.ts generated vendored Normal file
View file

@ -0,0 +1,55 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ControlParams, EventParams, CustomParams, ConsentSettings } from './public-types';
/**
* Encapsulates metadata concerning throttled fetch requests.
*/
export interface ThrottleMetadata {
backoffCount: number;
throttleEndTimeMillis: number;
}
/**
* Dynamic configuration fetched from server.
* See https://firebase.google.com/docs/reference/firebase-management/rest/v1beta1/projects.webApps/getConfig
*/
export interface DynamicConfig {
projectId: string;
appId: string;
databaseURL: string;
storageBucket: string;
locationId: string;
apiKey: string;
authDomain: string;
messagingSenderId: string;
measurementId: string;
}
export interface MinimalDynamicConfig {
appId: string;
measurementId: string;
}
/**
* Standard `gtag` function provided by gtag.js.
*/
export interface Gtag {
(command: 'config', targetId: string, config?: ControlParams | EventParams | CustomParams): void;
(command: 'set', config: CustomParams): void;
(command: 'event', eventName: string, eventParams?: ControlParams | EventParams | CustomParams): void;
(command: 'consent', subCommand: 'default' | 'update', consentSettings: ConsentSettings): void;
(command: 'get', measurementId: string, fieldName: string, callback: (...args: unknown[]) => void): void;
(command: string, ...args: unknown[]): void;
}
export declare type DataLayer = IArguments[];

View file

@ -0,0 +1,29 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FirebaseApp } from '@firebase/app';
import { _FirebaseInstallationsInternal } from '@firebase/installations';
export declare function getFakeApp(fakeAppParams?: {
appId?: string;
apiKey?: string;
measurementId?: string;
}): FirebaseApp;
export declare function getFakeInstallations(fid?: string, onFidResolve?: Function): _FirebaseInstallationsInternal;
export declare function getFullApp(fakeAppParams?: {
appId?: string;
apiKey?: string;
measurementId?: string;
}): FirebaseApp;

View file

@ -0,0 +1 @@
export declare function removeGtagScripts(): void;

View file

@ -0,0 +1,18 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import '@firebase/installations';
import '../setup';

View file

@ -0,0 +1,17 @@
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export {};

73
node_modules/@firebase/analytics/package.json generated vendored Normal file
View file

@ -0,0 +1,73 @@
{
"name": "@firebase/analytics",
"version": "0.10.9",
"description": "A analytics package for new firebase packages",
"author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
"main": "dist/index.cjs.js",
"browser": "dist/esm/index.esm2017.js",
"module": "dist/esm/index.esm2017.js",
"exports": {
".": {
"types": "./dist/analytics-public.d.ts",
"require": "./dist/index.cjs.js",
"default": "./dist/esm/index.esm2017.js"
},
"./package.json": "./package.json"
},
"files": [
"dist"
],
"scripts": {
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
"lint:fix": "eslint --fix -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",
"build": "rollup -c && yarn api-report",
"build:release": "yarn build && yarn typings:public",
"build:deps": "lerna run --scope @firebase/analytics --include-dependencies build",
"dev": "rollup -c -w",
"test": "run-p --npm-path npm lint test:all",
"test:all": "run-p --npm-path npm test:browser test:integration",
"test:ci": "node ../../scripts/run_tests_in_ci.js -s test:all",
"test:browser": "karma start --nocache",
"test:integration": "karma start ./karma.integration.conf.js --nocache",
"trusted-type-check": "tsec -p tsconfig.json --noEmit",
"api-report": "api-extractor run --local --verbose",
"doc": "api-documenter markdown --input temp --output docs",
"build:doc": "yarn build && yarn doc",
"typings:public": "node ../../scripts/build/use_typings.js ./dist/analytics-public.d.ts"
},
"peerDependencies": {
"@firebase/app": "0.x"
},
"dependencies": {
"@firebase/installations": "0.6.10",
"@firebase/logger": "0.4.3",
"@firebase/util": "1.10.1",
"@firebase/component": "0.6.10",
"tslib": "^2.1.0"
},
"license": "Apache-2.0",
"devDependencies": {
"@firebase/app": "0.10.14",
"rollup": "2.79.1",
"@rollup/plugin-commonjs": "21.1.0",
"@rollup/plugin-json": "4.1.0",
"@rollup/plugin-node-resolve": "13.3.0",
"rollup-plugin-typescript2": "0.31.2",
"typescript": "4.7.4"
},
"repository": {
"directory": "packages/analytics",
"type": "git",
"url": "git+https://github.com/firebase/firebase-js-sdk.git"
},
"bugs": {
"url": "https://github.com/firebase/firebase-js-sdk/issues"
},
"typings": "./dist/analytics-public.d.ts",
"nyc": {
"extension": [
".ts"
],
"reportDir": "./coverage/node"
}
}