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