diff --git a/packages/analytics/lib/index.d.ts b/packages/analytics/lib/index.d.ts index f06b3879c3..01ff442ea6 100644 --- a/packages/analytics/lib/index.d.ts +++ b/packages/analytics/lib/index.d.ts @@ -229,6 +229,7 @@ export namespace FirebaseAnalyticsTypes { */ value: number; } + export interface GenerateLeadEventParameters { /** * Purchase currency in 3 letter [ISO_4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format. E.g. `USD`. @@ -344,6 +345,7 @@ export namespace FirebaseAnalyticsTypes { * Current class associated with the view the user is currently viewing. */ screen_class?: string; + /** * Custom event parameters. */ @@ -395,7 +397,7 @@ export namespace FirebaseAnalyticsTypes { value?: number; /** * Purchase currency in 3 letter [ISO_4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes) format. E.g. `USD`. - x */ + x */ currency?: string; } @@ -456,6 +458,13 @@ export namespace FirebaseAnalyticsTypes { item_list_name: string; } + export interface SetCheckoutOptionEventParameters { + checkout_step?: EventParams['checkout_step']; + checkout_option?: EventParams['checkout_option']; + + [key: string]: any; + } + export interface SelectPromotionEventParameters { /** * The name of a creative used in a promotional spot @@ -518,6 +527,7 @@ export namespace FirebaseAnalyticsTypes { */ value: number; } + export interface UnlockAchievementEventParameters { /** * Game achievement ID (String). @@ -617,6 +627,7 @@ export namespace FirebaseAnalyticsTypes { */ shipping_tier?: string; } + /** * Unsupported in "Enhanced Ecommerce reports": * https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics.Event#public-static-final-string-view_search_results @@ -630,12 +641,14 @@ export namespace FirebaseAnalyticsTypes { // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface Statics {} + /** * Analytics instance initialization options. Web only. */ export interface AnalyticsSettings { config?: GtagConfigParams | EventParams; } + /** * Additional options that can be passed to Analytics method calls such as logEvent. Web only. */ @@ -645,6 +658,7 @@ export namespace FirebaseAnalyticsTypes { */ global: boolean; } + /** * A set of common Google Analytics config settings recognized by gtag.js. Web only. */ @@ -702,8 +716,10 @@ export namespace FirebaseAnalyticsTypes { * See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features } */ allow_ad_personalization_signals?: boolean; + [key: string]: unknown; } + /** * Standard gtag.js event parameters. For more information, see the GA4 reference documentation. Web only. */ @@ -746,6 +762,7 @@ export namespace FirebaseAnalyticsTypes { page_title?: string; page_location?: string; page_path?: string; + [key: string]: unknown; } @@ -771,6 +788,7 @@ export namespace FirebaseAnalyticsTypes { * and other user protection. */ security_storage?: ConsentStatusString; + [key: string]: unknown; } @@ -933,6 +951,7 @@ export namespace FirebaseAnalyticsTypes { * ``` */ resetAnalyticsData(): Promise; + /** * E-Commerce Purchase event. This event signifies that an item(s) was purchased by a user. Note: This is different from the in-app purchase event, which is reported * automatically for Google Play-based apps. @@ -957,6 +976,7 @@ export namespace FirebaseAnalyticsTypes { * ``` */ logPurchase(params: PurchaseEventParameters): Promise; + /** * Sets or clears the screen name and class the user is currently viewing * @@ -971,6 +991,7 @@ export namespace FirebaseAnalyticsTypes { * */ logScreenView(params: ScreenViewParameters): Promise; + /** * Add Payment Info event. This event signifies that a user has submitted their payment information to your app. * @@ -1136,6 +1157,7 @@ export namespace FirebaseAnalyticsTypes { * @param params See {@link analytics.CampaignDetailsEventParameters}. */ logCampaignDetails(params: CampaignDetailsEventParameters): Promise; + /** * View Promotion event. This event signifies that a promotion was shown to a user. * @@ -1175,6 +1197,7 @@ export namespace FirebaseAnalyticsTypes { * @param params See {@link analytics.EarnVirtualCurrencyEventParameters}. */ logEarnVirtualCurrency(params: EarnVirtualCurrencyEventParameters): Promise; + /** * Generate Lead event. Log this event when a lead has been generated in the app to understand * the efficacy of your install and re-engagement campaigns. @@ -1305,6 +1328,7 @@ export namespace FirebaseAnalyticsTypes { * @param params See {@link analytics.PostScoreEventParameters}. */ logPostScore(params: PostScoreEventParameters): Promise; + /** * Remove from cart event. * @@ -1328,6 +1352,7 @@ export namespace FirebaseAnalyticsTypes { * @param params See {@link analytics.RemoveFromCartEventParameters}. */ logRemoveFromCart(params: RemoveFromCartEventParameters): Promise; + /** * E-Commerce Refund event. This event signifies that a refund was issued. * @@ -1370,6 +1395,7 @@ export namespace FirebaseAnalyticsTypes { * @param params See {@link analytics.SearchEventParameters}. */ logSearch(params: SearchEventParameters): Promise; + /** * Select Content event. This general purpose event signifies that a user has selected some * content of a certain type in an app. The content can be any object in your app. This event @@ -1389,6 +1415,7 @@ export namespace FirebaseAnalyticsTypes { * @param params See {@link analytics.SelectContentEventParameters}. */ logSelectContent(params: SelectContentEventParameters): Promise; + /** * Select Item event. This event signifies that an item was selected by a user from a list. * Use the appropriate parameters to contextualize the event. @@ -1414,6 +1441,7 @@ export namespace FirebaseAnalyticsTypes { * @param params See {@link analytics.SelectItemEventParameters}. */ logSelectItem(params: SelectItemEventParameters): Promise; + /** * Set checkout option event. * @@ -1587,6 +1615,7 @@ export namespace FirebaseAnalyticsTypes { * @param params See {@link analytics.ViewItemEventParameters}. */ logViewItem(params: ViewItemEventParameters): Promise; + /** * E-commerce View Cart event. This event signifies that a user has viewed their cart. Use this to analyze your purchase funnel. * @@ -1629,6 +1658,7 @@ export namespace FirebaseAnalyticsTypes { * @param params See {@link analytics.ViewItemListEventParameters}. */ logViewItemList(params: ViewItemListEventParameters): Promise; + /** * View Search Results event. Log this event when the user has been presented with the results of a search. * @@ -1675,6 +1705,42 @@ export namespace FirebaseAnalyticsTypes { */ initiateOnDeviceConversionMeasurementWithEmailAddress(emailAddress: string): Promise; } + + /** + * Any custom event name string not in the standard list of recommended event names. + */ + export declare type CustomEventName = T extends EventNameString ? never : T; + /** + * Type for standard Google Analytics event names. logEvent also accepts any custom string and interprets it as a custom event name. + */ + 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'; } declare const defaultExport: ReactNativeFirebase.FirebaseModuleWithStatics< @@ -1689,6 +1755,8 @@ export const firebase: ReactNativeFirebase.Module & { ): ReactNativeFirebase.FirebaseApp & { analytics(): FirebaseAnalyticsTypes.Module }; }; +export * from './modular'; + export default defaultExport; /** @@ -1698,6 +1766,7 @@ declare module '@react-native-firebase/app' { // eslint-disable-next-line @typescript-eslint/no-unused-vars namespace ReactNativeFirebase { import FirebaseModuleWithStatics = ReactNativeFirebase.FirebaseModuleWithStatics; + interface Module { analytics: FirebaseModuleWithStatics< FirebaseAnalyticsTypes.Module, diff --git a/packages/analytics/lib/modular/index.d.ts b/packages/analytics/lib/modular/index.d.ts new file mode 100644 index 0000000000..a83a5f0c30 --- /dev/null +++ b/packages/analytics/lib/modular/index.d.ts @@ -0,0 +1,1188 @@ +import { ReactNativeFirebase } from '@react-native-firebase/app'; +import { FirebaseAnalyticsTypes } from '..'; + +import AddPaymentInfoEventParameters = FirebaseAnalyticsTypes.AddPaymentInfoEventParameters; +import AddShippingInfoParameters = FirebaseAnalyticsTypes.AddShippingInfoParameters; +import AddToCartEventParameters = FirebaseAnalyticsTypes.AddToCartEventParameters; +import AddToWishlistEventParameters = FirebaseAnalyticsTypes.AddToWishlistEventParameters; +import Analytics = FirebaseAnalyticsTypes.Module; +import AnalyticsCallOptions = FirebaseAnalyticsTypes.AnalyticsCallOptions; +import AnalyticsSettings = FirebaseAnalyticsTypes.AnalyticsSettings; +import BeginCheckoutEventParameters = FirebaseAnalyticsTypes.BeginCheckoutEventParameters; +import CampaignDetailsEventParameters = FirebaseAnalyticsTypes.CampaignDetailsEventParameters; +import CustomEventName = FirebaseAnalyticsTypes.CustomEventName; +import EarnVirtualCurrencyEventParameters = FirebaseAnalyticsTypes.EarnVirtualCurrencyEventParameters; +import EventParams = FirebaseAnalyticsTypes.EventParams; +import FirebaseApp = ReactNativeFirebase.FirebaseApp; +import GenerateLeadEventParameters = FirebaseAnalyticsTypes.GenerateLeadEventParameters; +import JoinGroupEventParameters = FirebaseAnalyticsTypes.JoinGroupEventParameters; +import LevelEndEventParameters = FirebaseAnalyticsTypes.LevelEndEventParameters; +import LevelStartEventParameters = FirebaseAnalyticsTypes.LevelStartEventParameters; +import LevelUpEventParameters = FirebaseAnalyticsTypes.LevelUpEventParameters; +import LoginEventParameters = FirebaseAnalyticsTypes.LoginEventParameters; +import PostScoreEventParameters = FirebaseAnalyticsTypes.PostScoreEventParameters; +import PurchaseEventParameters = FirebaseAnalyticsTypes.PurchaseEventParameters; +import RefundEventParameters = FirebaseAnalyticsTypes.RefundEventParameters; +import RemoveFromCartEventParameters = FirebaseAnalyticsTypes.RemoveFromCartEventParameters; +import ScreenViewParameters = FirebaseAnalyticsTypes.ScreenViewParameters; +import SearchEventParameters = FirebaseAnalyticsTypes.SearchEventParameters; +import SelectContentEventParameters = FirebaseAnalyticsTypes.SelectContentEventParameters; +import SelectItemEventParameters = FirebaseAnalyticsTypes.SelectItemEventParameters; +import SelectPromotionEventParameters = FirebaseAnalyticsTypes.SelectPromotionEventParameters; +import SetCheckoutOptionEventParameters = FirebaseAnalyticsTypes.SetCheckoutOptionEventParameters; +import ShareEventParameters = FirebaseAnalyticsTypes.ShareEventParameters; +import SignUpEventParameters = FirebaseAnalyticsTypes.SignUpEventParameters; +import SpendVirtualCurrencyEventParameters = FirebaseAnalyticsTypes.SpendVirtualCurrencyEventParameters; +import UnlockAchievementEventParameters = FirebaseAnalyticsTypes.UnlockAchievementEventParameters; +import ViewCartEventParameters = FirebaseAnalyticsTypes.ViewCartEventParameters; +import ViewItemEventParameters = FirebaseAnalyticsTypes.ViewItemEventParameters; +import ViewItemListEventParameters = FirebaseAnalyticsTypes.ViewItemListEventParameters; +import ViewPromotionEventParameters = FirebaseAnalyticsTypes.ViewPromotionEventParameters; +import ViewSearchResultsParameters = FirebaseAnalyticsTypes.ViewSearchResultsParameters; +import ConsentSettings = FirebaseAnalyticsTypes.ConsentSettings; +import SettingsOptions = FirebaseAnalyticsTypes.SettingsOptions; + +/** + * Returns an Analytics instance for the given app. + * + * @param app - FirebaseApp. Optional. + */ +export declare function getAnalytics(app?: FirebaseApp): Analytics; + +/** + * Returns an Analytics instance for the given app. + * + * @param app - FirebaseApp. + * @param options - `AnalyticsSettings`. Web only. + */ +export declare function initializeAnalytics( + app: FirebaseApp, + options?: AnalyticsSettings, +): Analytics; + +/** + * Log a custom event with optional params. Note that there are various limits that applied + * to event parameters (total parameter count, etc), but analytics applies the limits during + * cloud processing, the errors will not be seen as Promise rejections when you call logEvent. + * While integrating this API in your app you are strongly encouraged to enable + * [DebugView](https://firebase.google.com/docs/analytics/debugview) - + * any errors in your events will show up in the firebase web console with links to relevant documentation + * + * @param analytics Analytics instance. + * @param name Event name must not conflict with any Reserved Events. + * @param params Parameters to be sent and displayed with the event. + * @param options Additional options that can be passed. Web only. + */ +export declare function logEvent( + analytics: Analytics, + name: 'add_payment_info', + params?: { + coupon?: EventParams['coupon']; + currency?: EventParams['currency']; + items?: EventParams['items']; + payment_type?: EventParams['payment_type']; + value?: EventParams['value']; + [key: string]: any; + }, + options?: AnalyticsCallOptions, +): Promise; + +/** + * Log a custom event with optional params. Note that there are various limits that applied + * to event parameters (total parameter count, etc), but analytics applies the limits during + * cloud processing, the errors will not be seen as Promise rejections when you call logEvent. + * While integrating this API in your app you are strongly encouraged to enable + * [DebugView](https://firebase.google.com/docs/analytics/debugview) - + * any errors in your events will show up in the firebase web console with links to relevant documentation + * + * @param analytics Analytics instance. + * @param name Event name must not conflict with any Reserved Events. + * @param params Parameters to be sent and displayed with the event. + * @param options Additional options that can be passed. Web only. + */ +export declare function logEvent( + analytics: Analytics, + name: 'purchase' | 'refund', + params?: { + 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, +): Promise; + +/** + * Log a custom event with optional params. Note that there are various limits that applied + * to event parameters (total parameter count, etc), but analytics applies the limits during + * cloud processing, the errors will not be seen as Promise rejections when you call logEvent. + * While integrating this API in your app you are strongly encouraged to enable + * [DebugView](https://firebase.google.com/docs/analytics/debugview) - + * any errors in your events will show up in the firebase web console with links to relevant documentation + * + * @param analytics Analytics instance. + * @param name Event name must not conflict with any Reserved Events. + * @param params Parameters to be sent and displayed with the event. + * @param options Additional options that can be passed. Web only. + */ +export declare function logEvent( + analytics: Analytics, + name: 'screen_view', + params?: { + firebase_screen: EventParams['firebase_screen']; + firebase_screen_class: EventParams['firebase_screen_class']; + [key: string]: any; + }, + options?: AnalyticsCallOptions, +): Promise; + +/** + * Log a custom event with optional params. Note that there are various limits that applied + * to event parameters (total parameter count, etc), but analytics applies the limits during + * cloud processing, the errors will not be seen as Promise rejections when you call logEvent. + * While integrating this API in your app you are strongly encouraged to enable + * [DebugView](https://firebase.google.com/docs/analytics/debugview) - + * any errors in your events will show up in the firebase web console with links to relevant documentation + * + * @param analytics Analytics instance. + * @param name Event name must not conflict with any Reserved Events. + * @param params Parameters to be sent and displayed with the event. + * @param options Additional options that can be passed. Web only. + */ +export declare function logEvent( + analytics: Analytics, + name: 'search' | 'view_search_results', + params?: { + search_term?: EventParams['search_term']; + [key: string]: any; + }, + options?: AnalyticsCallOptions, +): Promise; + +/** + * Log a custom event with optional params. Note that there are various limits that applied + * to event parameters (total parameter count, etc), but analytics applies the limits during + * cloud processing, the errors will not be seen as Promise rejections when you call logEvent. + * While integrating this API in your app you are strongly encouraged to enable + * [DebugView](https://firebase.google.com/docs/analytics/debugview) - + * any errors in your events will show up in the firebase web console with links to relevant documentation + * + * @param analytics Analytics instance. + * @param name Event name must not conflict with any Reserved Events. + * @param params Parameters to be sent and displayed with the event. + * @param options Additional options that can be passed. Web only. + */ +export declare function logEvent( + analytics: Analytics, + name: 'select_content', + params?: { + content_type?: EventParams['content_type']; + item_id?: EventParams['item_id']; + [key: string]: any; + }, + options?: AnalyticsCallOptions, +): Promise; + +/** + * Log a custom event with optional params. Note that there are various limits that applied + * to event parameters (total parameter count, etc), but analytics applies the limits during + * cloud processing, the errors will not be seen as Promise rejections when you call logEvent. + * While integrating this API in your app you are strongly encouraged to enable + * [DebugView](https://firebase.google.com/docs/analytics/debugview) - + * any errors in your events will show up in the firebase web console with links to relevant documentation + * + * @param analytics Analytics instance. + * @param name Event name must not conflict with any Reserved Events. + * @param params Parameters to be sent and displayed with the event. + * @param options Additional options that can be passed. Web only. + */ +export declare function logEvent( + analytics: Analytics, + name: 'select_item', + params?: { + items?: EventParams['items']; + item_list_name?: EventParams['item_list_name']; + item_list_id?: EventParams['item_list_id']; + [key: string]: any; + }, + options?: AnalyticsCallOptions, +): Promise; + +/** + * Log a custom event with optional params. Note that there are various limits that applied + * to event parameters (total parameter count, etc), but analytics applies the limits during + * cloud processing, the errors will not be seen as Promise rejections when you call logEvent. + * While integrating this API in your app you are strongly encouraged to enable + * [DebugView](https://firebase.google.com/docs/analytics/debugview) - + * any errors in your events will show up in the firebase web console with links to relevant documentation + * + * @param analytics Analytics instance. + * @param name Event name must not conflict with any Reserved Events. + * @param params Parameters to be sent and displayed with the event. + * @param options Additional options that can be passed. Web only. + */ +export declare function logEvent( + analytics: Analytics, + name: 'select_promotion' | 'view_promotion', + params?: { + items?: EventParams['items']; + promotion_id?: EventParams['promotion_id']; + promotion_name?: EventParams['promotion_name']; + [key: string]: any; + }, + options?: AnalyticsCallOptions, +): Promise; + +/** + * Log a custom event with optional params. Note that there are various limits that applied + * to event parameters (total parameter count, etc), but analytics applies the limits during + * cloud processing, the errors will not be seen as Promise rejections when you call logEvent. + * While integrating this API in your app you are strongly encouraged to enable + * [DebugView](https://firebase.google.com/docs/analytics/debugview) - + * any errors in your events will show up in the firebase web console with links to relevant documentation + * + * @param analytics Analytics instance. + * @param name Event name must not conflict with any Reserved Events. + * @param params Parameters to be sent and displayed with the event. + * @param options Additional options that can be passed. Web only. + */ +export declare function logEvent( + analytics: Analytics, + name: 'set_checkout_option', + params?: { + checkout_step?: EventParams['checkout_step']; + checkout_option?: EventParams['checkout_option']; + [key: string]: any; + }, + options?: AnalyticsCallOptions, +): Promise; + +/** + * Log a custom event with optional params. Note that there are various limits that applied + * to event parameters (total parameter count, etc), but analytics applies the limits during + * cloud processing, the errors will not be seen as Promise rejections when you call logEvent. + * While integrating this API in your app you are strongly encouraged to enable + * [DebugView](https://firebase.google.com/docs/analytics/debugview) - + * any errors in your events will show up in the firebase web console with links to relevant documentation + * + * @param analytics Analytics instance. + * @param name Event name must not conflict with any Reserved Events. + * @param params Parameters to be sent and displayed with the event. + * @param options Additional options that can be passed. Web only. + */ +export declare function logEvent( + analytics: Analytics, + name: 'share', + params?: { + method?: EventParams['method']; + content_type?: EventParams['content_type']; + item_id?: EventParams['item_id']; + [key: string]: any; + }, + options?: AnalyticsCallOptions, +): Promise; + +/** + * Log a custom event with optional params. Note that there are various limits that applied + * to event parameters (total parameter count, etc), but analytics applies the limits during + * cloud processing, the errors will not be seen as Promise rejections when you call logEvent. + * While integrating this API in your app you are strongly encouraged to enable + * [DebugView](https://firebase.google.com/docs/analytics/debugview) - + * any errors in your events will show up in the firebase web console with links to relevant documentation + * + * @param analytics Analytics instance. + * @param name Event name must not conflict with any Reserved Events. + * @param params Parameters to be sent and displayed with the event. + * @param options Additional options that can be passed. Web only. + */ +export declare function logEvent( + analytics: Analytics, + name: 'sign_up', + params?: { + method?: EventParams['method']; + [key: string]: any; + }, + options?: AnalyticsCallOptions, +): Promise; + +/** + * Log a custom event with optional params. Note that there are various limits that applied + * to event parameters (total parameter count, etc), but analytics applies the limits during + * cloud processing, the errors will not be seen as Promise rejections when you call logEvent. + * While integrating this API in your app you are strongly encouraged to enable + * [DebugView](https://firebase.google.com/docs/analytics/debugview) - + * any errors in your events will show up in the firebase web console with links to relevant documentation + * + * @param analytics Analytics instance. + * @param name Event name must not conflict with any Reserved Events. + * @param params Parameters to be sent and displayed with the event. + * @param options Additional options that can be passed. Web only. + */ +export declare function logEvent( + analytics: Analytics, + name: 'timing_complete', + params?: { + name: string; + value: number; + event_category?: string; + event_label?: string; + [key: string]: any; + }, + options?: AnalyticsCallOptions, +): Promise; + +/** + * Log a custom event with optional params. Note that there are various limits that applied + * to event parameters (total parameter count, etc), but analytics applies the limits during + * cloud processing, the errors will not be seen as Promise rejections when you call logEvent. + * While integrating this API in your app you are strongly encouraged to enable + * [DebugView](https://firebase.google.com/docs/analytics/debugview) - + * any errors in your events will show up in the firebase web console with links to relevant documentation + * + * @param analytics Analytics instance. + * @param name Event name must not conflict with any Reserved Events. + * @param params Parameters to be sent and displayed with the event. + * @param options Additional options that can be passed. Web only. + */ +export declare function logEvent( + analytics: Analytics, + name: 'add_shipping_info', + params?: { + coupon?: EventParams['coupon']; + currency?: EventParams['currency']; + items?: EventParams['items']; + shipping_tier?: EventParams['shipping_tier']; + value?: EventParams['value']; + [key: string]: any; + }, + options?: AnalyticsCallOptions, +): Promise; + +/** + * Log a custom event with optional params. Note that there are various limits that applied + * to event parameters (total parameter count, etc), but analytics applies the limits during + * cloud processing, the errors will not be seen as Promise rejections when you call logEvent. + * While integrating this API in your app you are strongly encouraged to enable + * [DebugView](https://firebase.google.com/docs/analytics/debugview) - + * any errors in your events will show up in the firebase web console with links to relevant documentation + * + * @param analytics Analytics instance. + * @param name Event name must not conflict with any Reserved Events. + * @param params Parameters to be sent and displayed with the event. + * @param options Additional options that can be passed. Web only. + */ +export declare function logEvent( + analytics: Analytics, + name: 'view_cart' | 'view_item', + params?: { + currency?: EventParams['currency']; + items?: EventParams['items']; + value?: EventParams['value']; + [key: string]: any; + }, + options?: AnalyticsCallOptions, +): Promise; + +/** + * Log a custom event with optional params. Note that there are various limits that applied + * to event parameters (total parameter count, etc), but analytics applies the limits during + * cloud processing, the errors will not be seen as Promise rejections when you call logEvent. + * While integrating this API in your app you are strongly encouraged to enable + * [DebugView](https://firebase.google.com/docs/analytics/debugview) - + * any errors in your events will show up in the firebase web console with links to relevant documentation + * + * @param analytics Analytics instance. + * @param name Event name must not conflict with any Reserved Events. + * @param params Parameters to be sent and displayed with the event. + * @param options Additional options that can be passed. Web only. + */ +export declare function logEvent( + analytics: Analytics, + name: 'view_item_list', + params?: { + items?: EventParams['items']; + item_list_name?: EventParams['item_list_name']; + item_list_id?: EventParams['item_list_id']; + [key: string]: any; + }, + options?: AnalyticsCallOptions, +): Promise; + +/** + * Log a custom event with optional params. Note that there are various limits that applied + * to event parameters (total parameter count, etc), but analytics applies the limits during + * cloud processing, the errors will not be seen as Promise rejections when you call logEvent. + * While integrating this API in your app you are strongly encouraged to enable + * [DebugView](https://firebase.google.com/docs/analytics/debugview) - + * any errors in your events will show up in the firebase web console with links to relevant documentation + * + * @param analytics Analytics instance. + * @param name Event name must not conflict with any Reserved Events. + * @param params Parameters to be sent and displayed with the event. + * @param options Additional options that can be passed. Web only. + */ +export declare function logEvent( + analytics: Analytics, + name: CustomEventName, + params?: { + [key: string]: any; + }, + options?: AnalyticsCallOptions, +): Promise; + +/** + * Log a custom event with optional params. Note that there are various limits that applied + * to event parameters (total parameter count, etc), but analytics applies the limits during + * cloud processing, the errors will not be seen as Promise rejections when you call logEvent. + * While integrating this API in your app you are strongly encouraged to enable + * [DebugView](https://firebase.google.com/docs/analytics/debugview) - + * any errors in your events will show up in the firebase web console with links to relevant documentation + * + * @param analytics Analytics instance. + * @param name Event name must not conflict with any Reserved Events. + * @param params Parameters to be sent and displayed with the event. + * @param options Additional options that can be passed. Web only. + */ +export declare function logEvent( + analytics: Analytics, + name: 'add_to_cart' | 'add_to_wishlist' | 'remove_from_cart', + params?: { + currency?: EventParams['currency']; + value?: EventParams['value']; + items?: EventParams['items']; + [key: string]: any; + }, + options?: AnalyticsCallOptions, +): Promise; + +/** + * Log a custom event with optional params. Note that there are various limits that applied + * to event parameters (total parameter count, etc), but analytics applies the limits during + * cloud processing, the errors will not be seen as Promise rejections when you call logEvent. + * While integrating this API in your app you are strongly encouraged to enable + * [DebugView](https://firebase.google.com/docs/analytics/debugview) - + * any errors in your events will show up in the firebase web console with links to relevant documentation + * + * @param analytics Analytics instance. + * @param name Event name must not conflict with any Reserved Events. + * @param params Parameters to be sent and displayed with the event. + * @param options Additional options that can be passed. Web only. + */ +export declare function logEvent( + analytics: Analytics, + name: 'begin_checkout', + params?: { + currency?: EventParams['currency']; + coupon?: EventParams['coupon']; + value?: EventParams['value']; + items?: EventParams['items']; + [key: string]: any; + }, + options?: AnalyticsCallOptions, +): Promise; + +/** + * Log a custom event with optional params. Note that there are various limits that applied + * to event parameters (total parameter count, etc), but analytics applies the limits during + * cloud processing, the errors will not be seen as Promise rejections when you call logEvent. + * While integrating this API in your app you are strongly encouraged to enable + * [DebugView](https://firebase.google.com/docs/analytics/debugview) - + * any errors in your events will show up in the firebase web console with links to relevant documentation + * + * @param analytics Analytics instance. + * @param name Event name must not conflict with any Reserved Events. + * @param params Parameters to be sent and displayed with the event. + * @param options Additional options that can be passed. Web only. + */ +export declare function logEvent( + analytics: Analytics, + name: 'checkout_progress', + params?: { + 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, +): Promise; + +/** + * Log a custom event with optional params. Note that there are various limits that applied + * to event parameters (total parameter count, etc), but analytics applies the limits during + * cloud processing, the errors will not be seen as Promise rejections when you call logEvent. + * While integrating this API in your app you are strongly encouraged to enable + * [DebugView](https://firebase.google.com/docs/analytics/debugview) - + * any errors in your events will show up in the firebase web console with links to relevant documentation + * + * @param analytics Analytics instance. + * @param name Event name must not conflict with any Reserved Events. + * @param params Parameters to be sent and displayed with the event. + * @param options Additional options that can be passed. Web only. + */ +export declare function logEvent( + analytics: Analytics, + name: 'exception', + params?: { + description?: EventParams['description']; + fatal?: EventParams['fatal']; + [key: string]: any; + }, + options?: AnalyticsCallOptions, +): Promise; + +/** + * Log a custom event with optional params. Note that there are various limits that applied + * to event parameters (total parameter count, etc), but analytics applies the limits during + * cloud processing, the errors will not be seen as Promise rejections when you call logEvent. + * While integrating this API in your app you are strongly encouraged to enable + * [DebugView](https://firebase.google.com/docs/analytics/debugview) - + * any errors in your events will show up in the firebase web console with links to relevant documentation + * + * @param analytics Analytics instance. + * @param name Event name must not conflict with any Reserved Events. + * @param params Parameters to be sent and displayed with the event. + * @param options Additional options that can be passed. Web only. + */ +export declare function logEvent( + analytics: Analytics, + name: 'generate_lead', + params?: { + value?: EventParams['value']; + currency?: EventParams['currency']; + [key: string]: any; + }, + options?: AnalyticsCallOptions, +): Promise; + +/** + * Log a custom event with optional params. Note that there are various limits that applied + * to event parameters (total parameter count, etc), but analytics applies the limits during + * cloud processing, the errors will not be seen as Promise rejections when you call logEvent. + * While integrating this API in your app you are strongly encouraged to enable + * [DebugView](https://firebase.google.com/docs/analytics/debugview) - + * any errors in your events will show up in the firebase web console with links to relevant documentation + * + * @param analytics Analytics instance. + * @param name Event name must not conflict with any Reserved Events. + * @param params Parameters to be sent and displayed with the event. + * @param options Additional options that can be passed. Web only. + */ +export declare function logEvent( + analytics: Analytics, + name: 'login', + params?: { + method?: EventParams['method']; + [key: string]: any; + }, + options?: AnalyticsCallOptions, +): Promise; + +/** + * Log a custom event with optional params. Note that there are various limits that applied + * to event parameters (total parameter count, etc), but analytics applies the limits during + * cloud processing, the errors will not be seen as Promise rejections when you call logEvent. + * While integrating this API in your app you are strongly encouraged to enable + * [DebugView](https://firebase.google.com/docs/analytics/debugview) - + * any errors in your events will show up in the firebase web console with links to relevant documentation + * + * @param analytics Analytics instance. + * @param name Event name must not conflict with any Reserved Events. + * @param params Parameters to be sent and displayed with the event. + * @param options Additional options that can be passed. Web only. + */ +export declare function logEvent( + analytics: Analytics, + name: 'page_view', + params?: { + page_title?: string; + page_location?: string; + page_path?: string; + [key: string]: any; + }, + options?: AnalyticsCallOptions, +): Promise; + +/** + * If true, allows the device to collect analytical data and send it to + * Firebase. Useful for GDPR. + */ +export declare function setAnalyticsCollectionEnabled( + analyticsInstance: Analytics, + enabled: boolean, +): Promise; + +/** + * Sets the duration of inactivity that terminates the current session. + * + * @param analytics Analytics instance. + * @param milliseconds The default value is 1800000 (30 minutes). + */ +export declare function setSessionTimeoutDuration( + analytics: Analytics, + milliseconds: number, +): Promise; + +/** + * Retrieve the app instance id of the application. + * + * @param analytics Analytics instance. + * @returns Returns the app instance id or null on android if FirebaseAnalytics.ConsentType.ANALYTICS_STORAGE has been set to FirebaseAnalytics.ConsentStatus.DENIED and null on iOS if ConsentType.analyticsStorage has been set to ConsentStatus.denied. + */ +export function getAppInstanceId(analytics: Analytics): Promise; + +/** + * Gives a user a unique identification. + * + * @param analytics Analytics instance. + * @param id Set to null to remove a previously assigned ID from analytics + * events + */ +export function setUserId(analytics: Analytics, id: string | null): Promise; + +/** + * Sets a key/value pair of data on the current user. Each Firebase project can have up to 25 uniquely named (case-sensitive) user properties. + * + * @param analytics Analytics instance. + * @param name A user property identifier. + * @param value Set to null to remove a previously assigned ID from analytics events. + */ +export function setUserProperty( + analytics: Analytics, + name: string, + value: string | null, +): Promise; + +/** + * Sets multiple key/value pairs of data on the current user. Each Firebase project can have up to 25 uniquely named (case-sensitive) user properties. + * + * > When you set user properties, be sure to never include personally identifiable information such as names, social security numbers, or email addresses, even in hashed form. + * + * @param analytics Analytics instance. + * @param properties Set a property value to null to remove it. + * @param options `AnalyticsCallOptions`. Additional options that can be passed. Web only. + */ +export function setUserProperties( + analytics: Analytics, + properties: { [key: string]: any }, + options?: AnalyticsCallOptions, +): Promise; + +/** + * Clears all analytics data for this instance from the device and resets the app instance ID. + * + * @param analytics Analytics instance. + */ +export function resetAnalyticsData(analytics: Analytics): Promise; + +/** + * E-Commerce Purchase event. This event signifies that an item(s) was purchased by a user. Note: This is different from the in-app purchase event, which is reported + * automatically for Google Play-based apps. + * + * If you supply the `value` parameter, you must also supply the `currency` parameter so that revenue metrics can be computed accurately. + * + * Logged event name: `purchase` + * + * @param analytics Analytics instance. + * @param object See {@link analytics.AddPaymentInfoEventParameters}. + */ +export function logAddPaymentInfo( + analytics: Analytics, + object: AddPaymentInfoEventParameters, +): Promise; + +/** + * Sets or clears the screen name and class the user is currently viewing + * + * @param analytics Analytics instance. + * @param params See {@link analytics.ScreenViewParameters}. + */ +export function logScreenView(analytics: Analytics, params: ScreenViewParameters): Promise; + +/** + * Add Payment Info event. This event signifies that a user has submitted their payment information to your app. + * + * If you supply the `value` parameter, you must also supply the `currency` parameter so that revenue metrics can be computed accurately. + * + * Logged event name: `add_payment_info` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.AddShippingInfoParameters}. + */ +export function logAddShippingInfo( + analytics: Analytics, + params: AddShippingInfoParameters, +): Promise; + +/** + * E-Commerce Add To Cart event. + * + * If you supply the `value` parameter, you must also supply the `currency` parameter so that revenue metrics can be computed accurately. + * + * Logged event name: `add_to_cart` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.AddToCartEventParameters}. + */ +export function logAddToCart(analytics: Analytics, params: AddToCartEventParameters): Promise; + +/** + * E-Commerce Add To Wishlist event. This event signifies that an item was added to a wishlist. + * Use this event to identify popular gift items in your app. + * + * If you supply the `value` parameter, you must also supply the `currency` parameter so that revenue metrics can be computed accurately. + * + * Logged event name: `add_to_wishlist + * + * @param analytics Analytics instance. + * @param params See {@link analytics.AddToWishlistEventParameters}. + */ +export function logAddToWishlist(analytics, params: AddToWishlistEventParameters): Promise; + +/** + * App Open event. By logging this event when an App is moved to the foreground, developers can + * understand how often users leave and return during the course of a Session. Although Sessions + * are automatically reported, this event can provide further clarification around the continuous + * engagement of app-users. + * + * @param analytics Analytics instance. + */ +export function logAppOpen(analytics: Analytics): Promise; + +/** + * E-Commerce Begin Checkout event. This event signifies that a user has begun the process of + * checking out. + * + * If you supply the `value` parameter, you must also supply the `currency` parameter so that revenue metrics can be computed accurately. + * + * Logged event name: `begin_checkout` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.BeginCheckoutEventParameters}. + */ +export function logBeginCheckout( + analytics: Analytics, + params: BeginCheckoutEventParameters, +): Promise; + +/** + * Log this event to supply the referral details of a re-engagement campaign. + * + * Logged event name: `campaign_details` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.CampaignDetailsEventParameters}. + */ +export function logCampaignDetails( + analytics: Analytics, + params: CampaignDetailsEventParameters, +): Promise; + +/** + * Earn Virtual Currency event. This event tracks the awarding of virtual currency in your app. Log this along with + * {@link analytics.logSpendVirtualCurrency} to better understand your virtual economy. + * + * Logged event name: `earn_virtual_currency` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.EarnVirtualCurrencyEventParameters}. + */ +export function logEarnVirtualCurrency( + analytics: Analytics, + params: EarnVirtualCurrencyEventParameters, +): Promise; + +/** + * Generate Lead event. Log this event when a lead has been generated in the app to understand + * the efficacy of your install and re-engagement campaigns. + * + * If you supply the `value` parameter, you must also supply the `currency` parameter so that revenue metrics can be computed accurately. + * + * Logged event name: `generate_lead` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.GenerateLeadEventParameters}. + */ +export function logGenerateLead( + analytics: Analytics, + params: GenerateLeadEventParameters, +): Promise; + +/** + * Join Group event. Log this event when a user joins a group such as a guild, team or family. + * Use this event to analyze how popular certain groups or social features are in your app + * + * Logged event name: `join_group` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.JoinGroupEventParameters}. + */ +export function logJoinGroup(analytics: Analytics, params: JoinGroupEventParameters): Promise; + +/** + * Level End event. + * + * Logged event name: `level_end` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.LevelEndEventParameters}. + */ +export function logLevelEnd(analytics: Analytics, params: LevelEndEventParameters): Promise; + +/** + * Level Start event. + * + * Logged event name: `level_start` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.LevelStartEventParameters}. + */ +export function logLevelStart( + analytics: Analytics, + params: LevelStartEventParameters, +): Promise; + +/** + * Level Up event. This event signifies that a player has leveled up in your gaming app. + * It can help you gauge the level distribution of your userbase and help you identify certain levels that are difficult to pass. + * + * Logged event name: `level_up` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.LevelUpEventParameters}. + */ +export function logLevelUp(analytics: Analytics, params: LevelUpEventParameters): Promise; + +/** + * Login event. Apps with a login feature can report this event to signify that a user has logged in. + * + * Logged event name: `login` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.LoginEventParameters}. + */ +export function logLogin(analytics: Analytics, params: LoginEventParameters): Promise; + +/** + * Post Score event. Log this event when the user posts a score in your gaming app. This event can + * help you understand how users are actually performing in your game and it can help you correlate + * high scores with certain audiences or behaviors. + * + * Logged event name: `post_score` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.PostScoreEventParameters}. + */ +export function logPostScore(analytics: Analytics, params: PostScoreEventParameters): Promise; + +/** + * Select Content event. This general purpose event signifies that a user has selected some + * content of a certain type in an app. The content can be any object in your app. This event + * can help you identify popular content and categories of content in your app. + * + * Logged event name: `select_content` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.SelectContentEventParameters}. + */ +export function logSelectContent( + analytics: Analytics, + params: SelectContentEventParameters, +): Promise; + +/** + * E-Commerce Purchase event. This event signifies that an item(s) was purchased by a user. Note: This is different from the in-app purchase event, which is reported + * automatically for Google Play-based apps. + * + * If you supply the `value` parameter, you must also supply the `currency` parameter so that revenue metrics can be computed accurately. + * + * Logged event name: `purchase` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.PurchaseEventParameters}. + */ +export function logPurchase(analytics: Analytics, params: PurchaseEventParameters): Promise; + +/** + * E-Commerce Refund event. This event signifies that a refund was issued. + * + * Logged event name: `remove_from_cart` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.RefundEventParameters}. + */ +export function logRefund(analytics: Analytics, params: RefundEventParameters): Promise; + +/** + * Remove from cart event. + * + * Logged event name: `remove_from_cart` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.RemoveFromCartEventParameters}. + */ +export function logRemoveFromCart( + analytics: Analytics, + params: RemoveFromCartEventParameters, +): Promise; + +/** + * Search event. Apps that support search features can use this event to contextualize search + * operations by supplying the appropriate, corresponding parameters. This event can help you + * identify the most popular content in your app. + * + * Logged event name: `search` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.SearchEventParameters}. + */ +export function logSearch(analytics: Analytics, params: SearchEventParameters): Promise; + +/** + * Select Item event. This event signifies that an item was selected by a user from a list. + * Use the appropriate parameters to contextualize the event. + * Use this event to discover the most popular items selected. + * + * Logged event name: `select_item` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.SelectItemEventParameters}. + */ +export function logSelectItem( + analytics: Analytics, + params: SelectItemEventParameters, +): Promise; + +/** + * Set checkout option event. + * + * Logged event name: `set_checkout_option` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.SetCheckoutOptionEventParameters}. + */ +export function logSetCheckoutOption( + analytics: Analytics, + params: SetCheckoutOptionEventParameters, +): Promise; + +/** + * Select promotion event. This event signifies that a user has selected a promotion offer. Use the + * appropriate parameters to contextualize the event, such as the item(s) for which the promotion applies. + * + * Logged event name: `select_promotion` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.SelectPromotionEventParameters}. + */ +export function logSelectPromotion( + analytics: Analytics, + params: SelectPromotionEventParameters, +): Promise; + +/** + * Share event. Apps with social features can log the Share event to identify the most viral content. + * + * Logged event name: `share` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.ShareEventParameters}. + */ +export function logShare(analytics: Analytics, params: ShareEventParameters): Promise; + +/** + * Sign Up event. This event indicates that a user has signed up for an account in your app. + * The parameter signifies the method by which the user signed up. Use this event to understand + * the different behaviors between logged in and logged out users. + * + * Logged event name: `sign_up` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.SignUpEventParameters}. + */ +export function logSignUp(analytics: Analytics, params: SignUpEventParameters): Promise; + +/** + * Spend Virtual Currency event. This event tracks the sale of virtual goods in your app and can + * help you identify which virtual goods are the most popular objects of purchase. + * + * Logged event name: `spend_virtual_currency` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.SpendVirtualCurrencyEventParameters}. + */ +export function logSpendVirtualCurrency( + analytics: Analytics, + params: SpendVirtualCurrencyEventParameters, +): Promise; + +/** + * Tutorial Begin event. This event signifies the start of the on-boarding process in your app. + * Use this in a funnel with {@link analytics#logTutorialComplete} to understand how many users + * complete this process and move on to the full app experience. + * + * Logged event name: `tutorial_begin` + * + * @param analytics Analytics instance. + */ +export function logTutorialBegin(analytics: Analytics): Promise; + +/** + * Tutorial End event. Use this event to signify the user's completion of your app's on-boarding process. + * Add this to a funnel with {@link analytics#logTutorialBegin} to understand how many users + * complete this process and move on to the full app experience. + * + * Logged event name: `tutorial_complete` + * + * @param analytics Analytics instance. + */ +export function logTutorialComplete(analytics: Analytics): Promise; + +/** + * Unlock Achievement event. Log this event when the user has unlocked an achievement in your game. + * Since achievements generally represent the breadth of a gaming experience, this event can help + * you understand how many users are experiencing all that your game has to offer. + * + * Logged event name: `unlock_achievement` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.UnlockAchievementEventParameters}. + */ +export function logUnlockAchievement( + analytics: Analytics, + params: UnlockAchievementEventParameters, +): Promise; + +/** + * E-commerce View Cart event. This event signifies that a user has viewed their cart. Use this to analyze your purchase funnel. + * + * If you supply the `value` parameter, you must also supply the `currency` parameter so that revenue metrics can be computed accurately. + * + * Logged event name: `view_cart` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.ViewCartEventParameters}. + */ +export function logViewCart(analytics: Analytics, params: ViewCartEventParameters): Promise; + +/** + * View Item event. This event signifies that some content was shown to the user. This content + * may be a product, a screen or just a simple image or text. Use the appropriate parameters + * to contextualize the event. Use this event to discover the most popular items viewed in your app. + * + * If you supply the `value` parameter, you must also supply the `currency` parameter so that revenue metrics can be computed accurately. + * + * Logged event name: `view_item` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.ViewItemEventParameters}. + */ +export function logViewItem(analytics: Analytics, params: ViewItemEventParameters): Promise; + +/** + * View Item List event. Log this event when the user has been presented with a list of items of a certain category. + * + * Logged event name: `view_item_list` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.ViewItemListEventParameters}. + */ +export function logViewItemList( + analytics: Analytics, + params: ViewItemListEventParameters, +): Promise; + +/** + * View Promotion event. This event signifies that a promotion was shown to a user. + * + * Logged event name: `view_promotion` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.ViewPromotionEventParameters}. + */ +export function logViewPromotion( + analytics: Analytics, + params: ViewPromotionEventParameters, +): Promise; + +/** + * View Search Results event. Log this event when the user has been presented with the results of a search. + * + * Logged event name: `view_search_results` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.ViewSearchResultsParameters}. + */ +export function logViewSearchResults( + analytics: Analytics, + params: ViewSearchResultsParameters, +): Promise; + +/** + * Adds parameters that will be set on every event logged from the SDK, including automatic ones. + * + * They will be added to the map of default event parameters, replacing any existing + * parameter with the same name. Valid parameter values are String, long, and double. + * Setting a key's value to null will clear that parameter. Passing in a null bundle + * will clear all parameters. + * For Web, the values passed persist on the current page and are passed with all + * subsequent events. + * + * @param analytics Analytics instance. + * @param params Parameters to be added to the map of parameters added to every event. + */ +export function setDefaultEventParameters( + analytics: Analytics, + params: { [p: string]: any }, +): Promise; + +/** + * start privacy-sensitive on-device conversion management. + * This is iOS-only. + * This is a no-op if you do not include '$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true' in your Podfile + * + * @param analytics Analytics instance. + * @param emailAddress email address, properly formatted complete with domain name e.g, 'user@example.com' + */ +export function initiateOnDeviceConversionMeasurementWithEmailAddress( + analytics: Analytics, + emailAddress: string, +): Promise; + +/** + * Checks four different things. + * 1. Checks if it's not a browser extension environment. + * 2. Checks if cookies are enabled in current browser. + * 3. Checks if IndexedDB is supported by the browser environment. + * 4. Checks if the current browser context is valid for using IndexedDB.open(). + * + * @returns {Promise} + */ +export function isSupported(): Promise; + +/** + * Sets the applicable end user consent state for this web app across all gtag + * references once Firebase Analytics is initialized. Web only. + * @param analytics Analytics instance. + * @param consentSettings See {@link analytics.ConsentSettings}. + * @returns {void} + */ +export function setConsent(analytics: Analytics, consentSettings: ConsentSettings): 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. Web only. + * @param options See {@link analytics.SettingsOptions}. + * @returns {void} + */ +export function settings(options: SettingsOptions): void; diff --git a/packages/analytics/modular/index.js b/packages/analytics/lib/modular/index.js similarity index 98% rename from packages/analytics/modular/index.js rename to packages/analytics/lib/modular/index.js index dcbdfbf1b7..4b807ed5cf 100644 --- a/packages/analytics/modular/index.js +++ b/packages/analytics/lib/modular/index.js @@ -52,6 +52,7 @@ export function logEvent(analytics, name, eventParams = {}, options = {}) { export function setAnalyticsCollectionEnabled(analytics, enabled) { return analytics.setAnalyticsCollectionEnabled(enabled); } + /** * Sets the duration of inactivity that terminates the current session. * @@ -61,6 +62,7 @@ export function setAnalyticsCollectionEnabled(analytics, enabled) { export function setSessionTimeoutDuration(analytics, milliseconds = 1800000) { return analytics.setSessionTimeoutDuration(milliseconds); } + /** * Retrieve the app instance id of the application. * @@ -70,6 +72,7 @@ export function setSessionTimeoutDuration(analytics, milliseconds = 1800000) { export function getAppInstanceId(analytics) { return analytics.getAppInstanceId(); } + /** * Gives a user a unique identification. * @@ -80,6 +83,7 @@ export function getAppInstanceId(analytics) { export function setUserId(analytics, id) { return analytics.setUserId(id); } + /** * Sets a key/value pair of data on the current user. Each Firebase project can have up to 25 uniquely named (case-sensitive) user properties. * @@ -90,6 +94,7 @@ export function setUserId(analytics, id) { export function setUserProperty(analytics, name, value) { return analytics.setUserProperty(name, value); } + /** * Sets multiple key/value pairs of data on the current user. Each Firebase project can have up to 25 uniquely named (case-sensitive) user properties. * @@ -102,6 +107,7 @@ export function setUserProperty(analytics, name, value) { export function setUserProperties(analytics, properties, options = {}) { return analytics.setUserProperties(properties, options); } + /** * Clears all analytics data for this instance from the device and resets the app instance ID. * @@ -110,6 +116,7 @@ export function setUserProperties(analytics, properties, options = {}) { export function resetAnalyticsData(analytics) { return analytics.resetAnalyticsData(); } + /** * E-Commerce Purchase event. This event signifies that an item(s) was purchased by a user. Note: This is different from the in-app purchase event, which is reported * automatically for Google Play-based apps. @@ -124,6 +131,7 @@ export function resetAnalyticsData(analytics) { export function logAddPaymentInfo(analytics, object = {}) { return analytics.logAddPaymentInfo(object); } + /** * Sets or clears the screen name and class the user is currently viewing * @@ -133,6 +141,7 @@ export function logAddPaymentInfo(analytics, object = {}) { export function logScreenView(analytics, object = {}) { return analytics.logScreenView(object); } + /** * Add Payment Info event. This event signifies that a user has submitted their payment information to your app. * @@ -146,6 +155,7 @@ export function logScreenView(analytics, object = {}) { export function logAddShippingInfo(analytics, object = {}) { return analytics.logAddShippingInfo(object); } + /** * E-Commerce Add To Cart event. * @@ -159,6 +169,7 @@ export function logAddShippingInfo(analytics, object = {}) { export function logAddToCart(analytics, object = {}) { return analytics.logAddToCart(object); } + /** * E-Commerce Add To Wishlist event. This event signifies that an item was added to a wishlist. * Use this event to identify popular gift items in your app. @@ -173,6 +184,7 @@ export function logAddToCart(analytics, object = {}) { export function logAddToWishlist(analytics, object = {}) { return analytics.logAddToWishlist(object); } + /** * App Open event. By logging this event when an App is moved to the foreground, developers can * understand how often users leave and return during the course of a Session. Although Sessions @@ -184,6 +196,7 @@ export function logAddToWishlist(analytics, object = {}) { export function logAppOpen(analytics) { return analytics.logAppOpen(); } + /** * E-Commerce Begin Checkout event. This event signifies that a user has begun the process of * checking out. @@ -198,6 +211,7 @@ export function logAppOpen(analytics) { export function logBeginCheckout(analytics, object = {}) { return analytics.logBeginCheckout(object); } + /** * Log this event to supply the referral details of a re-engagement campaign. * @@ -209,6 +223,7 @@ export function logBeginCheckout(analytics, object = {}) { export function logCampaignDetails(analytics, object = {}) { return analytics.logCampaignDetails(object); } + /** * Earn Virtual Currency event. This event tracks the awarding of virtual currency in your app. Log this along with * {@link analytics.logSpendVirtualCurrency} to better understand your virtual economy. @@ -221,6 +236,7 @@ export function logCampaignDetails(analytics, object = {}) { export function logEarnVirtualCurrency(analytics, object = {}) { return analytics.logEarnVirtualCurrency(object); } + /** * Generate Lead event. Log this event when a lead has been generated in the app to understand * the efficacy of your install and re-engagement campaigns. @@ -235,6 +251,7 @@ export function logEarnVirtualCurrency(analytics, object = {}) { export function logGenerateLead(analytics, object = {}) { return analytics.logGenerateLead(object); } + /** * Join Group event. Log this event when a user joins a group such as a guild, team or family. * Use this event to analyze how popular certain groups or social features are in your app @@ -247,6 +264,7 @@ export function logGenerateLead(analytics, object = {}) { export function logJoinGroup(analytics, object = {}) { return analytics.logJoinGroup(object); } + /** * Level End event. * @@ -258,6 +276,7 @@ export function logJoinGroup(analytics, object = {}) { export function logLevelEnd(analytics, object = {}) { return analytics.logLevelEnd(object); } + /** * Level Start event. * @@ -269,6 +288,7 @@ export function logLevelEnd(analytics, object = {}) { export function logLevelStart(analytics, object = {}) { return analytics.logLevelStart(object); } + /** * Level Up event. This event signifies that a player has leveled up in your gaming app. * It can help you gauge the level distribution of your userbase and help you identify certain levels that are difficult to pass. @@ -281,6 +301,7 @@ export function logLevelStart(analytics, object = {}) { export function logLevelUp(analytics, object = {}) { return analytics.logLevelUp(object); } + /** * Login event. Apps with a login feature can report this event to signify that a user has logged in. * @@ -292,6 +313,7 @@ export function logLevelUp(analytics, object = {}) { export function logLogin(analytics, object = {}) { return analytics.logLogin(object); } + /** * Post Score event. Log this event when the user posts a score in your gaming app. This event can * help you understand how users are actually performing in your game and it can help you correlate @@ -305,6 +327,7 @@ export function logLogin(analytics, object = {}) { export function logPostScore(analytics, object = {}) { return analytics.logPostScore(object); } + /** * Select Content event. This general purpose event signifies that a user has selected some * content of a certain type in an app. The content can be any object in your app. This event @@ -318,6 +341,7 @@ export function logPostScore(analytics, object = {}) { export function logSelectContent(analytics, object = {}) { return analytics.logSelectContent(object); } + /** * E-Commerce Purchase event. This event signifies that an item(s) was purchased by a user. Note: This is different from the in-app purchase event, which is reported * automatically for Google Play-based apps. @@ -332,6 +356,7 @@ export function logSelectContent(analytics, object = {}) { export function logPurchase(analytics, object = {}) { return analytics.logPurchase(object); } + /** * E-Commerce Refund event. This event signifies that a refund was issued. * @@ -343,6 +368,7 @@ export function logPurchase(analytics, object = {}) { export function logRefund(analytics, object = {}) { return analytics.logRefund(object); } + /** * Remove from cart event. * @@ -354,6 +380,7 @@ export function logRefund(analytics, object = {}) { export function logRemoveFromCart(analytics, object = {}) { return analytics.logRemoveFromCart(object); } + /** * Search event. Apps that support search features can use this event to contextualize search * operations by supplying the appropriate, corresponding parameters. This event can help you @@ -367,6 +394,7 @@ export function logRemoveFromCart(analytics, object = {}) { export function logSearch(analytics, object = {}) { return analytics.logSearch(object); } + /** * Select Item event. This event signifies that an item was selected by a user from a list. * Use the appropriate parameters to contextualize the event. @@ -380,6 +408,7 @@ export function logSearch(analytics, object = {}) { export function logSelectItem(analytics, object = {}) { return analytics.logSelectItem(object); } + /** * Set checkout option event. * @@ -391,6 +420,7 @@ export function logSelectItem(analytics, object = {}) { export function logSetCheckoutOption(analytics, object = {}) { return analytics.logSetCheckoutOption(object); } + /** * Select promotion event. This event signifies that a user has selected a promotion offer. Use the * appropriate parameters to contextualize the event, such as the item(s) for which the promotion applies. @@ -403,6 +433,7 @@ export function logSetCheckoutOption(analytics, object = {}) { export function logSelectPromotion(analytics, object = {}) { return analytics.logSelectPromotion(object); } + /** * Share event. Apps with social features can log the Share event to identify the most viral content. * @@ -414,6 +445,7 @@ export function logSelectPromotion(analytics, object = {}) { export function logShare(analytics, object = {}) { return analytics.logShare(object); } + /** * Sign Up event. This event indicates that a user has signed up for an account in your app. * The parameter signifies the method by which the user signed up. Use this event to understand @@ -427,6 +459,7 @@ export function logShare(analytics, object = {}) { export function logSignUp(analytics, object = {}) { return analytics.logSignUp(object); } + /** * Spend Virtual Currency event. This event tracks the sale of virtual goods in your app and can * help you identify which virtual goods are the most popular objects of purchase. @@ -439,6 +472,7 @@ export function logSignUp(analytics, object = {}) { export function logSpendVirtualCurrency(analytics, object = {}) { return analytics.logSpendVirtualCurrency(object); } + /** * Tutorial Begin event. This event signifies the start of the on-boarding process in your app. * Use this in a funnel with {@link analytics#logTutorialComplete} to understand how many users @@ -451,6 +485,7 @@ export function logSpendVirtualCurrency(analytics, object = {}) { export function logTutorialBegin(analytics) { return analytics.logTutorialBegin(); } + /** * Tutorial End event. Use this event to signify the user's completion of your app's on-boarding process. * Add this to a funnel with {@link analytics#logTutorialBegin} to understand how many users @@ -463,6 +498,7 @@ export function logTutorialBegin(analytics) { export function logTutorialComplete(analytics) { return analytics.logTutorialComplete(); } + /** * Unlock Achievement event. Log this event when the user has unlocked an achievement in your game. * Since achievements generally represent the breadth of a gaming experience, this event can help @@ -476,6 +512,7 @@ export function logTutorialComplete(analytics) { export function logUnlockAchievement(analytics, object = {}) { return analytics.logUnlockAchievement(object); } + /** * E-commerce View Cart event. This event signifies that a user has viewed their cart. Use this to analyze your purchase funnel. * @@ -489,6 +526,7 @@ export function logUnlockAchievement(analytics, object = {}) { export function logViewCart(analytics, object = {}) { return analytics.logViewCart(object); } + /** * View Item event. This event signifies that some content was shown to the user. This content * may be a product, a screen or just a simple image or text. Use the appropriate parameters @@ -504,6 +542,7 @@ export function logViewCart(analytics, object = {}) { export function logViewItem(analytics, object = {}) { return analytics.logViewItem(object); } + /** * View Item List event. Log this event when the user has been presented with a list of items of a certain category. * @@ -516,9 +555,18 @@ export function logViewItemList(analytics, object = {}) { return analytics.logViewItemList(object); } +/** + * View Promotion event. This event signifies that a promotion was shown to a user. + * + * Logged event name: `view_promotion` + * + * @param analytics Analytics instance. + * @param params See {@link analytics.ViewPromotionEventParameters}. + */ export function logViewPromotion(analytics, object = {}) { return analytics.logViewPromotion(object); } + /** * View Search Results event. Log this event when the user has been presented with the results of a search. * @@ -530,6 +578,7 @@ export function logViewPromotion(analytics, object = {}) { export function logViewSearchResults(analytics, object = {}) { return analytics.logViewSearchResults(object); } + /** * Adds parameters that will be set on every event logged from the SDK, including automatic ones. * @@ -545,6 +594,7 @@ export function logViewSearchResults(analytics, object = {}) { export function setDefaultEventParameters(analytics, params = {}) { return analytics.setDefaultEventParameters(params); } + /** * start privacy-sensitive on-device conversion management. * This is iOS-only. @@ -569,6 +619,7 @@ export function isSupported() { // always return "true" for now until Web implementation. Web only. return Promise.resolve(true); } + /** * Sets the applicable end user consent state for this web app across all gtag * references once Firebase Analytics is initialized. Web only. @@ -577,7 +628,7 @@ export function isSupported() { * @returns {void} */ // eslint-disable-next-line -export function setConsent(consentSettings) { +export function setConsent(analytics, consentSettings) { // Returns nothing until Web implemented. }