UNPKG

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