Без опису
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

analytics-public.d.ts 26KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748
  1. /**
  2. * Firebase Analytics
  3. *
  4. * @packageDocumentation
  5. */
  6. import { FirebaseApp } from '@firebase/app';
  7. /**
  8. * An instance of Firebase Analytics.
  9. * @public
  10. */
  11. export declare interface Analytics {
  12. /**
  13. * The {@link @firebase/app#FirebaseApp} this {@link Analytics} instance is associated with.
  14. */
  15. app: FirebaseApp;
  16. }
  17. /**
  18. * Additional options that can be passed to Analytics method
  19. * calls such as `logEvent`, etc.
  20. * @public
  21. */
  22. export declare interface AnalyticsCallOptions {
  23. /**
  24. * If true, this config or event call applies globally to all
  25. * Google Analytics properties on the page.
  26. */
  27. global: boolean;
  28. }
  29. /**
  30. * {@link Analytics} instance initialization options.
  31. * @public
  32. */
  33. export declare interface AnalyticsSettings {
  34. /**
  35. * Params to be passed in the initial `gtag` config call during Firebase
  36. * Analytics initialization.
  37. */
  38. config?: GtagConfigParams | EventParams;
  39. }
  40. /**
  41. * Consent status settings for each consent type.
  42. * For more information, see
  43. * {@link https://developers.google.com/tag-platform/tag-manager/templates/consent-apis
  44. * | the GA4 reference documentation for consent state and consent types}.
  45. * @public
  46. */
  47. export declare interface ConsentSettings {
  48. /** Enables storage, such as cookies, related to advertising */
  49. ad_storage?: ConsentStatusString;
  50. /** Enables storage, such as cookies, related to analytics (for example, visit duration) */
  51. analytics_storage?: ConsentStatusString;
  52. /**
  53. * Enables storage that supports the functionality of the website or app such as language settings
  54. */
  55. functionality_storage?: ConsentStatusString;
  56. /** Enables storage related to personalization such as video recommendations */
  57. personalization_storage?: ConsentStatusString;
  58. /**
  59. * Enables storage related to security such as authentication functionality, fraud prevention,
  60. * and other user protection.
  61. */
  62. security_storage?: ConsentStatusString;
  63. [key: string]: unknown;
  64. }
  65. /**
  66. * Whether a particular consent type has been granted or denied.
  67. * @public
  68. */
  69. export declare type ConsentStatusString = 'granted' | 'denied';
  70. /**
  71. * Standard `gtag.js` control parameters.
  72. * For more information, see
  73. * {@link https://developers.google.com/gtagjs/reference/ga4-events
  74. * | the GA4 reference documentation}.
  75. * @public
  76. */
  77. export declare interface ControlParams {
  78. groups?: string | string[];
  79. send_to?: string | string[];
  80. event_callback?: () => void;
  81. event_timeout?: number;
  82. }
  83. /**
  84. * Standard Google Analytics currency type.
  85. * @public
  86. */
  87. export declare type Currency = string | number;
  88. /**
  89. * Any custom event name string not in the standard list of recommended
  90. * event names.
  91. * @public
  92. */
  93. export declare type CustomEventName<T> = T extends EventNameString ? never : T;
  94. /**
  95. * Any custom params the user may pass to `gtag`.
  96. * @public
  97. */
  98. export declare interface CustomParams {
  99. [key: string]: unknown;
  100. }
  101. /**
  102. * Type for standard Google Analytics event names. `logEvent` also accepts any
  103. * custom string and interprets it as a custom event name.
  104. * @public
  105. */
  106. 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';
  107. /**
  108. * Standard `gtag.js` event parameters.
  109. * For more information, see
  110. * {@link https://developers.google.com/gtagjs/reference/ga4-events
  111. * | the GA4 reference documentation}.
  112. * @public
  113. */
  114. export declare interface EventParams {
  115. checkout_option?: string;
  116. checkout_step?: number;
  117. item_id?: string;
  118. content_type?: string;
  119. coupon?: string;
  120. currency?: string;
  121. description?: string;
  122. fatal?: boolean;
  123. items?: Item[];
  124. method?: string;
  125. number?: string;
  126. promotions?: Promotion[];
  127. screen_name?: string;
  128. /**
  129. * Firebase-specific. Use to log a `screen_name` to Firebase Analytics.
  130. */
  131. firebase_screen?: string;
  132. /**
  133. * Firebase-specific. Use to log a `screen_class` to Firebase Analytics.
  134. */
  135. firebase_screen_class?: string;
  136. search_term?: string;
  137. shipping?: Currency;
  138. tax?: Currency;
  139. transaction_id?: string;
  140. value?: number;
  141. event_label?: string;
  142. event_category?: string;
  143. shipping_tier?: string;
  144. item_list_id?: string;
  145. item_list_name?: string;
  146. promotion_id?: string;
  147. promotion_name?: string;
  148. payment_type?: string;
  149. affiliation?: string;
  150. page_title?: string;
  151. page_location?: string;
  152. page_path?: string;
  153. [key: string]: unknown;
  154. }
  155. /**
  156. * Returns an {@link Analytics} instance for the given app.
  157. *
  158. * @public
  159. *
  160. * @param app - The {@link @firebase/app#FirebaseApp} to use.
  161. */
  162. export declare function getAnalytics(app?: FirebaseApp): Analytics;
  163. /**
  164. * A set of common Google Analytics config settings recognized by
  165. * `gtag.js`.
  166. * @public
  167. */
  168. export declare interface GtagConfigParams {
  169. /**
  170. * Whether or not a page view should be sent.
  171. * If set to true (default), a page view is automatically sent upon initialization
  172. * of analytics.
  173. * See {@link https://developers.google.com/analytics/devguides/collection/ga4/page-view | Page views }
  174. */
  175. 'send_page_view'?: boolean;
  176. /**
  177. * The title of the page.
  178. * See {@link https://developers.google.com/analytics/devguides/collection/ga4/page-view | Page views }
  179. */
  180. 'page_title'?: string;
  181. /**
  182. * The URL of the page.
  183. * See {@link https://developers.google.com/analytics/devguides/collection/ga4/page-view | Page views }
  184. */
  185. 'page_location'?: string;
  186. /**
  187. * Defaults to `auto`.
  188. * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
  189. */
  190. 'cookie_domain'?: string;
  191. /**
  192. * Defaults to 63072000 (two years, in seconds).
  193. * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
  194. */
  195. 'cookie_expires'?: number;
  196. /**
  197. * Defaults to `_ga`.
  198. * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
  199. */
  200. 'cookie_prefix'?: string;
  201. /**
  202. * If set to true, will update cookies on each page load.
  203. * Defaults to true.
  204. * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
  205. */
  206. 'cookie_update'?: boolean;
  207. /**
  208. * Appends additional flags to the cookie when set.
  209. * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
  210. */
  211. 'cookie_flags'?: string;
  212. /**
  213. * If set to false, disables all advertising features with `gtag.js`.
  214. * See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features }
  215. */
  216. 'allow_google_signals'?: boolean;
  217. /**
  218. * If set to false, disables all advertising personalization with `gtag.js`.
  219. * See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features }
  220. */
  221. 'allow_ad_personalization_signals'?: boolean;
  222. [key: string]: unknown;
  223. }
  224. /**
  225. * Returns an {@link Analytics} instance for the given app.
  226. *
  227. * @public
  228. *
  229. * @param app - The {@link @firebase/app#FirebaseApp} to use.
  230. */
  231. export declare function initializeAnalytics(app: FirebaseApp, options?: AnalyticsSettings): Analytics;
  232. /**
  233. * This is a public static method provided to users that wraps four different checks:
  234. *
  235. * 1. Check if it's not a browser extension environment.
  236. * 2. Check if cookies are enabled in current browser.
  237. * 3. Check if IndexedDB is supported by the browser environment.
  238. * 4. Check if the current browser context is valid for using `IndexedDB.open()`.
  239. *
  240. * @public
  241. *
  242. */
  243. export declare function isSupported(): Promise<boolean>;
  244. /**
  245. * Standard Google Analytics `Item` type.
  246. * @public
  247. */
  248. export declare interface Item {
  249. item_id?: string;
  250. item_name?: string;
  251. item_brand?: string;
  252. item_category?: string;
  253. item_category2?: string;
  254. item_category3?: string;
  255. item_category4?: string;
  256. item_category5?: string;
  257. item_variant?: string;
  258. price?: Currency;
  259. quantity?: number;
  260. index?: number;
  261. coupon?: string;
  262. item_list_name?: string;
  263. item_list_id?: string;
  264. discount?: Currency;
  265. affiliation?: string;
  266. creative_name?: string;
  267. creative_slot?: string;
  268. promotion_id?: string;
  269. promotion_name?: string;
  270. location_id?: string;
  271. /** @deprecated Use item_brand instead. */
  272. brand?: string;
  273. /** @deprecated Use item_category instead. */
  274. category?: string;
  275. /** @deprecated Use item_id instead. */
  276. id?: string;
  277. /** @deprecated Use item_name instead. */
  278. name?: string;
  279. }
  280. /**
  281. * Sends a Google Analytics event with given `eventParams`. This method
  282. * automatically associates this logged event with this Firebase web
  283. * app instance on this device.
  284. * @public
  285. * List of recommended event parameters can be found in
  286. * {@link https://developers.google.com/gtagjs/reference/ga4-events
  287. * | the GA4 reference documentation}.
  288. */
  289. export declare function logEvent(analyticsInstance: Analytics, eventName: 'add_payment_info', eventParams?: {
  290. coupon?: EventParams['coupon'];
  291. currency?: EventParams['currency'];
  292. items?: EventParams['items'];
  293. payment_type?: EventParams['payment_type'];
  294. value?: EventParams['value'];
  295. [key: string]: any;
  296. }, options?: AnalyticsCallOptions): void;
  297. /**
  298. * Sends a Google Analytics event with given `eventParams`. This method
  299. * automatically associates this logged event with this Firebase web
  300. * app instance on this device.
  301. * @public
  302. * List of recommended event parameters can be found in
  303. * {@link https://developers.google.com/gtagjs/reference/ga4-events
  304. * | the GA4 reference documentation}.
  305. */
  306. export declare function logEvent(analyticsInstance: Analytics, eventName: 'add_shipping_info', eventParams?: {
  307. coupon?: EventParams['coupon'];
  308. currency?: EventParams['currency'];
  309. items?: EventParams['items'];
  310. shipping_tier?: EventParams['shipping_tier'];
  311. value?: EventParams['value'];
  312. [key: string]: any;
  313. }, options?: AnalyticsCallOptions): void;
  314. /**
  315. * Sends a Google Analytics event with given `eventParams`. This method
  316. * automatically associates this logged event with this Firebase web
  317. * app instance on this device.
  318. * @public
  319. * List of recommended event parameters can be found in
  320. * {@link https://developers.google.com/gtagjs/reference/ga4-events
  321. * | the GA4 reference documentation}.
  322. */
  323. export declare function logEvent(analyticsInstance: Analytics, eventName: 'add_to_cart' | 'add_to_wishlist' | 'remove_from_cart', eventParams?: {
  324. currency?: EventParams['currency'];
  325. value?: EventParams['value'];
  326. items?: EventParams['items'];
  327. [key: string]: any;
  328. }, options?: AnalyticsCallOptions): void;
  329. /**
  330. * Sends a Google Analytics event with given `eventParams`. This method
  331. * automatically associates this logged event with this Firebase web
  332. * app instance on this device.
  333. * @public
  334. * List of recommended event parameters can be found in
  335. * {@link https://developers.google.com/gtagjs/reference/ga4-events
  336. * | the GA4 reference documentation}.
  337. */
  338. export declare function logEvent(analyticsInstance: Analytics, eventName: 'begin_checkout', eventParams?: {
  339. currency?: EventParams['currency'];
  340. coupon?: EventParams['coupon'];
  341. value?: EventParams['value'];
  342. items?: EventParams['items'];
  343. [key: string]: any;
  344. }, options?: AnalyticsCallOptions): void;
  345. /**
  346. * Sends a Google Analytics event with given `eventParams`. This method
  347. * automatically associates this logged event with this Firebase web
  348. * app instance on this device.
  349. * @public
  350. * List of recommended event parameters can be found in
  351. * {@link https://developers.google.com/gtagjs/reference/ga4-events
  352. * | the GA4 reference documentation}.
  353. */
  354. export declare function logEvent(analyticsInstance: Analytics, eventName: 'checkout_progress', eventParams?: {
  355. currency?: EventParams['currency'];
  356. coupon?: EventParams['coupon'];
  357. value?: EventParams['value'];
  358. items?: EventParams['items'];
  359. checkout_step?: EventParams['checkout_step'];
  360. checkout_option?: EventParams['checkout_option'];
  361. [key: string]: any;
  362. }, options?: AnalyticsCallOptions): void;
  363. /**
  364. * Sends a Google Analytics event with given `eventParams`. This method
  365. * automatically associates this logged event with this Firebase web
  366. * app instance on this device.
  367. * @public
  368. * See
  369. * {@link https://developers.google.com/analytics/devguides/collection/ga4/exceptions
  370. * | Measure exceptions}.
  371. */
  372. export declare function logEvent(analyticsInstance: Analytics, eventName: 'exception', eventParams?: {
  373. description?: EventParams['description'];
  374. fatal?: EventParams['fatal'];
  375. [key: string]: any;
  376. }, options?: AnalyticsCallOptions): void;
  377. /**
  378. * Sends a Google Analytics event with given `eventParams`. This method
  379. * automatically associates this logged event with this Firebase web
  380. * app instance on this device.
  381. * @public
  382. * List of recommended event parameters can be found in
  383. * {@link https://developers.google.com/gtagjs/reference/ga4-events
  384. * | the GA4 reference documentation}.
  385. */
  386. export declare function logEvent(analyticsInstance: Analytics, eventName: 'generate_lead', eventParams?: {
  387. value?: EventParams['value'];
  388. currency?: EventParams['currency'];
  389. [key: string]: any;
  390. }, options?: AnalyticsCallOptions): void;
  391. /**
  392. * Sends a Google Analytics event with given `eventParams`. This method
  393. * automatically associates this logged event with this Firebase web
  394. * app instance on this device.
  395. * @public
  396. * List of recommended event parameters can be found in
  397. * {@link https://developers.google.com/gtagjs/reference/ga4-events
  398. * | the GA4 reference documentation}.
  399. */
  400. export declare function logEvent(analyticsInstance: Analytics, eventName: 'login', eventParams?: {
  401. method?: EventParams['method'];
  402. [key: string]: any;
  403. }, options?: AnalyticsCallOptions): void;
  404. /**
  405. * Sends a Google Analytics event with given `eventParams`. This method
  406. * automatically associates this logged event with this Firebase web
  407. * app instance on this device.
  408. * @public
  409. * See
  410. * {@link https://developers.google.com/analytics/devguides/collection/ga4/page-view
  411. * | Page views}.
  412. */
  413. export declare function logEvent(analyticsInstance: Analytics, eventName: 'page_view', eventParams?: {
  414. page_title?: string;
  415. page_location?: string;
  416. page_path?: string;
  417. [key: string]: any;
  418. }, options?: AnalyticsCallOptions): void;
  419. /**
  420. * Sends a Google Analytics event with given `eventParams`. This method
  421. * automatically associates this logged event with this Firebase web
  422. * app instance on this device.
  423. * @public
  424. * List of recommended event parameters can be found in
  425. * {@link https://developers.google.com/gtagjs/reference/ga4-events
  426. * | the GA4 reference documentation}.
  427. */
  428. export declare function logEvent(analyticsInstance: Analytics, eventName: 'purchase' | 'refund', eventParams?: {
  429. value?: EventParams['value'];
  430. currency?: EventParams['currency'];
  431. transaction_id: EventParams['transaction_id'];
  432. tax?: EventParams['tax'];
  433. shipping?: EventParams['shipping'];
  434. items?: EventParams['items'];
  435. coupon?: EventParams['coupon'];
  436. affiliation?: EventParams['affiliation'];
  437. [key: string]: any;
  438. }, options?: AnalyticsCallOptions): void;
  439. /**
  440. * Sends a Google Analytics event with given `eventParams`. This method
  441. * automatically associates this logged event with this Firebase web
  442. * app instance on this device.
  443. * @public
  444. * See {@link https://firebase.google.com/docs/analytics/screenviews
  445. * | Track Screenviews}.
  446. */
  447. export declare function logEvent(analyticsInstance: Analytics, eventName: 'screen_view', eventParams?: {
  448. firebase_screen: EventParams['firebase_screen'];
  449. firebase_screen_class: EventParams['firebase_screen_class'];
  450. [key: string]: any;
  451. }, options?: AnalyticsCallOptions): void;
  452. /**
  453. * Sends a Google Analytics event with given `eventParams`. This method
  454. * automatically associates this logged event with this Firebase web
  455. * app instance on this device.
  456. * @public
  457. * List of recommended event parameters can be found in
  458. * {@link https://developers.google.com/gtagjs/reference/ga4-events
  459. * | the GA4 reference documentation}.
  460. */
  461. export declare function logEvent(analyticsInstance: Analytics, eventName: 'search' | 'view_search_results', eventParams?: {
  462. search_term?: EventParams['search_term'];
  463. [key: string]: any;
  464. }, options?: AnalyticsCallOptions): void;
  465. /**
  466. * Sends a Google Analytics event with given `eventParams`. This method
  467. * automatically associates this logged event with this Firebase web
  468. * app instance on this device.
  469. * @public
  470. * List of recommended event parameters can be found in
  471. * {@link https://developers.google.com/gtagjs/reference/ga4-events
  472. * | the GA4 reference documentation}.
  473. */
  474. export declare function logEvent(analyticsInstance: Analytics, eventName: 'select_content', eventParams?: {
  475. content_type?: EventParams['content_type'];
  476. item_id?: EventParams['item_id'];
  477. [key: string]: any;
  478. }, options?: AnalyticsCallOptions): void;
  479. /**
  480. * Sends a Google Analytics event with given `eventParams`. This method
  481. * automatically associates this logged event with this Firebase web
  482. * app instance on this device.
  483. * @public
  484. * List of recommended event parameters can be found in
  485. * {@link https://developers.google.com/gtagjs/reference/ga4-events
  486. * | the GA4 reference documentation}.
  487. */
  488. export declare function logEvent(analyticsInstance: Analytics, eventName: 'select_item', eventParams?: {
  489. items?: EventParams['items'];
  490. item_list_name?: EventParams['item_list_name'];
  491. item_list_id?: EventParams['item_list_id'];
  492. [key: string]: any;
  493. }, options?: AnalyticsCallOptions): void;
  494. /**
  495. * Sends a Google Analytics event with given `eventParams`. This method
  496. * automatically associates this logged event with this Firebase web
  497. * app instance on this device.
  498. * @public
  499. * List of recommended event parameters can be found in
  500. * {@link https://developers.google.com/gtagjs/reference/ga4-events
  501. * | the GA4 reference documentation}.
  502. */
  503. export declare function logEvent(analyticsInstance: Analytics, eventName: 'select_promotion' | 'view_promotion', eventParams?: {
  504. items?: EventParams['items'];
  505. promotion_id?: EventParams['promotion_id'];
  506. promotion_name?: EventParams['promotion_name'];
  507. [key: string]: any;
  508. }, options?: AnalyticsCallOptions): void;
  509. /**
  510. * Sends a Google Analytics event with given `eventParams`. This method
  511. * automatically associates this logged event with this Firebase web
  512. * app instance on this device.
  513. * @public
  514. * List of recommended event parameters can be found in
  515. * {@link https://developers.google.com/gtagjs/reference/ga4-events
  516. * | the GA4 reference documentation}.
  517. */
  518. export declare function logEvent(analyticsInstance: Analytics, eventName: 'set_checkout_option', eventParams?: {
  519. checkout_step?: EventParams['checkout_step'];
  520. checkout_option?: EventParams['checkout_option'];
  521. [key: string]: any;
  522. }, options?: AnalyticsCallOptions): void;
  523. /**
  524. * Sends a Google Analytics event with given `eventParams`. This method
  525. * automatically associates this logged event with this Firebase web
  526. * app instance on this device.
  527. * @public
  528. * List of recommended event parameters can be found in
  529. * {@link https://developers.google.com/gtagjs/reference/ga4-events
  530. * | the GA4 reference documentation}.
  531. */
  532. export declare function logEvent(analyticsInstance: Analytics, eventName: 'share', eventParams?: {
  533. method?: EventParams['method'];
  534. content_type?: EventParams['content_type'];
  535. item_id?: EventParams['item_id'];
  536. [key: string]: any;
  537. }, options?: AnalyticsCallOptions): void;
  538. /**
  539. * Sends a Google Analytics event with given `eventParams`. This method
  540. * automatically associates this logged event with this Firebase web
  541. * app instance on this device.
  542. * @public
  543. * List of recommended event parameters can be found in
  544. * {@link https://developers.google.com/gtagjs/reference/ga4-events
  545. * | the GA4 reference documentation}.
  546. */
  547. export declare function logEvent(analyticsInstance: Analytics, eventName: 'sign_up', eventParams?: {
  548. method?: EventParams['method'];
  549. [key: string]: any;
  550. }, options?: AnalyticsCallOptions): void;
  551. /**
  552. * Sends a Google Analytics event with given `eventParams`. This method
  553. * automatically associates this logged event with this Firebase web
  554. * app instance on this device.
  555. * @public
  556. * List of recommended event parameters can be found in
  557. * {@link https://developers.google.com/gtagjs/reference/ga4-events
  558. * | the GA4 reference documentation}.
  559. */
  560. export declare function logEvent(analyticsInstance: Analytics, eventName: 'timing_complete', eventParams?: {
  561. name: string;
  562. value: number;
  563. event_category?: string;
  564. event_label?: string;
  565. [key: string]: any;
  566. }, options?: AnalyticsCallOptions): void;
  567. /**
  568. * Sends a Google Analytics event with given `eventParams`. This method
  569. * automatically associates this logged event with this Firebase web
  570. * app instance on this device.
  571. * @public
  572. * List of recommended event parameters can be found in
  573. * {@link https://developers.google.com/gtagjs/reference/ga4-events
  574. * | the GA4 reference documentation}.
  575. */
  576. export declare function logEvent(analyticsInstance: Analytics, eventName: 'view_cart' | 'view_item', eventParams?: {
  577. currency?: EventParams['currency'];
  578. items?: EventParams['items'];
  579. value?: EventParams['value'];
  580. [key: string]: any;
  581. }, options?: AnalyticsCallOptions): void;
  582. /**
  583. * Sends a Google Analytics event with given `eventParams`. This method
  584. * automatically associates this logged event with this Firebase web
  585. * app instance on this device.
  586. * @public
  587. * List of recommended event parameters can be found in
  588. * {@link https://developers.google.com/gtagjs/reference/ga4-events
  589. * | the GA4 reference documentation}.
  590. */
  591. export declare function logEvent(analyticsInstance: Analytics, eventName: 'view_item_list', eventParams?: {
  592. items?: EventParams['items'];
  593. item_list_name?: EventParams['item_list_name'];
  594. item_list_id?: EventParams['item_list_id'];
  595. [key: string]: any;
  596. }, options?: AnalyticsCallOptions): void;
  597. /**
  598. * Sends a Google Analytics event with given `eventParams`. This method
  599. * automatically associates this logged event with this Firebase web
  600. * app instance on this device.
  601. * @public
  602. * List of recommended event parameters can be found in
  603. * {@link https://developers.google.com/gtagjs/reference/ga4-events
  604. * | the GA4 reference documentation}.
  605. */
  606. export declare function logEvent<T extends string>(analyticsInstance: Analytics, eventName: CustomEventName<T>, eventParams?: {
  607. [key: string]: any;
  608. }, options?: AnalyticsCallOptions): void;
  609. /**
  610. * Field previously used by some Google Analytics events.
  611. * @deprecated Use `Item` instead.
  612. * @public
  613. */
  614. export declare interface Promotion {
  615. creative_name?: string;
  616. creative_slot?: string;
  617. id?: string;
  618. name?: string;
  619. }
  620. /**
  621. * Sets whether Google Analytics collection is enabled for this app on this device.
  622. * Sets global `window['ga-disable-analyticsId'] = true;`
  623. *
  624. * @public
  625. *
  626. * @param analyticsInstance - The {@link Analytics} instance.
  627. * @param enabled - If true, enables collection, if false, disables it.
  628. */
  629. export declare function setAnalyticsCollectionEnabled(analyticsInstance: Analytics, enabled: boolean): void;
  630. /**
  631. * Sets the applicable end user consent state for this web app across all gtag references once
  632. * Firebase Analytics is initialized.
  633. *
  634. * Use the {@link ConsentSettings} to specify individual consent type values. By default consent
  635. * types are set to "granted".
  636. * @public
  637. * @param consentSettings - Maps the applicable end user consent state for gtag.js.
  638. */
  639. export declare function setConsent(consentSettings: ConsentSettings): void;
  640. /**
  641. * Use gtag `config` command to set `screen_name`.
  642. *
  643. * @public
  644. *
  645. * @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`.
  646. * See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}.
  647. *
  648. * @param analyticsInstance - The {@link Analytics} instance.
  649. * @param screenName - Screen name to set.
  650. */
  651. export declare function setCurrentScreen(analyticsInstance: Analytics, screenName: string, options?: AnalyticsCallOptions): void;
  652. /**
  653. * Adds data that will be set on every event logged from the SDK, including automatic ones.
  654. * With gtag's "set" command, the values passed persist on the current page and are passed with
  655. * all subsequent events.
  656. * @public
  657. * @param customParams - Any custom params the user may pass to gtag.js.
  658. */
  659. export declare function setDefaultEventParameters(customParams: CustomParams): void;
  660. /**
  661. * Configures Firebase Analytics to use custom `gtag` or `dataLayer` names.
  662. * Intended to be used if `gtag.js` script has been installed on
  663. * this page independently of Firebase Analytics, and is using non-default
  664. * names for either the `gtag` function or for `dataLayer`.
  665. * Must be called before calling `getAnalytics()` or it won't
  666. * have any effect.
  667. *
  668. * @public
  669. *
  670. * @param options - Custom gtag and dataLayer names.
  671. */
  672. export declare function settings(options: SettingsOptions): void;
  673. /**
  674. * Specifies custom options for your Firebase Analytics instance.
  675. * You must set these before initializing `firebase.analytics()`.
  676. * @public
  677. */
  678. export declare interface SettingsOptions {
  679. /** Sets custom name for `gtag` function. */
  680. gtagName?: string;
  681. /** Sets custom name for `dataLayer` array used by `gtag.js`. */
  682. dataLayerName?: string;
  683. }
  684. /**
  685. * Use gtag `config` command to set `user_id`.
  686. *
  687. * @public
  688. *
  689. * @param analyticsInstance - The {@link Analytics} instance.
  690. * @param id - User ID to set.
  691. */
  692. export declare function setUserId(analyticsInstance: Analytics, id: string | null, options?: AnalyticsCallOptions): void;
  693. /**
  694. * Use gtag `config` command to set all params specified.
  695. *
  696. * @public
  697. */
  698. export declare function setUserProperties(analyticsInstance: Analytics, properties: CustomParams, options?: AnalyticsCallOptions): void;
  699. export { }