@depup/firebase__analytics 0.10.20-depup.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/changes.json +10 -0
- package/dist/analytics-public.d.ts +763 -0
- package/dist/analytics.d.ts +763 -0
- package/dist/esm/index.esm.js +1272 -0
- package/dist/esm/index.esm.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/src/api.d.ts +453 -0
- package/dist/esm/src/constants.d.ts +32 -0
- package/dist/esm/src/errors.d.ts +57 -0
- package/dist/esm/src/factory.d.ts +74 -0
- package/dist/esm/src/functions.d.ts +85 -0
- package/dist/esm/src/get-config.d.ts +72 -0
- package/dist/esm/src/helpers.d.ts +70 -0
- package/dist/esm/src/index.d.ts +14 -0
- package/dist/esm/src/initialize-analytics.d.ts +36 -0
- package/dist/esm/src/logger.d.ts +18 -0
- package/dist/esm/src/public-types.d.ts +282 -0
- package/dist/esm/src/types.d.ts +55 -0
- package/dist/esm/testing/get-fake-firebase-services.d.ts +29 -0
- package/dist/esm/testing/gtag-script-util.d.ts +1 -0
- package/dist/esm/testing/integration-tests/integration.d.ts +18 -0
- package/dist/esm/testing/setup.d.ts +17 -0
- package/dist/index.cjs.js +1287 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/src/api.d.ts +453 -0
- package/dist/src/constants.d.ts +32 -0
- package/dist/src/errors.d.ts +57 -0
- package/dist/src/factory.d.ts +74 -0
- package/dist/src/functions.d.ts +85 -0
- package/dist/src/get-config.d.ts +72 -0
- package/dist/src/global_index.d.ts +1056 -0
- package/dist/src/helpers.d.ts +70 -0
- package/dist/src/index.d.ts +14 -0
- package/dist/src/initialize-analytics.d.ts +36 -0
- package/dist/src/logger.d.ts +18 -0
- package/dist/src/public-types.d.ts +282 -0
- package/dist/src/tsdoc-metadata.json +11 -0
- package/dist/src/types.d.ts +55 -0
- package/dist/testing/get-fake-firebase-services.d.ts +29 -0
- package/dist/testing/gtag-script-util.d.ts +1 -0
- package/dist/testing/integration-tests/integration.d.ts +18 -0
- package/dist/testing/setup.d.ts +17 -0
- package/package.json +95 -0
|
@@ -0,0 +1,1056 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
interface VersionService {
|
|
18
|
+
library: string;
|
|
19
|
+
version: string;
|
|
20
|
+
}
|
|
21
|
+
interface PlatformLoggerService {
|
|
22
|
+
getPlatformInfoString(): string;
|
|
23
|
+
}
|
|
24
|
+
interface HeartbeatService {
|
|
25
|
+
/**
|
|
26
|
+
* Called to report a heartbeat. The function will generate
|
|
27
|
+
* a HeartbeatsByUserAgent object, update heartbeatsCache, and persist it
|
|
28
|
+
* to IndexedDB.
|
|
29
|
+
* Note that we only store one heartbeat per day. So if a heartbeat for today is
|
|
30
|
+
* already logged, subsequent calls to this function in the same day will be ignored.
|
|
31
|
+
*/
|
|
32
|
+
triggerHeartbeat(): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Returns a base64 encoded string which can be attached to the heartbeat-specific header directly.
|
|
35
|
+
* It also clears all heartbeats from memory as well as in IndexedDB.
|
|
36
|
+
*/
|
|
37
|
+
getHeartbeatsHeader(): Promise<string>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @license
|
|
42
|
+
* Copyright 2020 Google LLC
|
|
43
|
+
*
|
|
44
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
45
|
+
* you may not use this file except in compliance with the License.
|
|
46
|
+
* You may obtain a copy of the License at
|
|
47
|
+
*
|
|
48
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
49
|
+
*
|
|
50
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
51
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
52
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
53
|
+
* See the License for the specific language governing permissions and
|
|
54
|
+
* limitations under the License.
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* A {@link @firebase/app#FirebaseApp} holds the initialization information for a collection of
|
|
59
|
+
* services.
|
|
60
|
+
*
|
|
61
|
+
* Do not call this constructor directly. Instead, use
|
|
62
|
+
* {@link (initializeApp:1) | initializeApp()} to create an app.
|
|
63
|
+
*
|
|
64
|
+
* @public
|
|
65
|
+
*/
|
|
66
|
+
interface FirebaseApp {
|
|
67
|
+
/**
|
|
68
|
+
* The (read-only) name for this app.
|
|
69
|
+
*
|
|
70
|
+
* The default app's name is `"[DEFAULT]"`.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```javascript
|
|
74
|
+
* // The default app's name is "[DEFAULT]"
|
|
75
|
+
* const app = initializeApp(defaultAppConfig);
|
|
76
|
+
* console.log(app.name); // "[DEFAULT]"
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```javascript
|
|
81
|
+
* // A named app's name is what you provide to initializeApp()
|
|
82
|
+
* const otherApp = initializeApp(otherAppConfig, "other");
|
|
83
|
+
* console.log(otherApp.name); // "other"
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
readonly name: string;
|
|
87
|
+
/**
|
|
88
|
+
* The (read-only) configuration options for this app. These are the original
|
|
89
|
+
* parameters given in {@link (initializeApp:1) | initializeApp()}.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```javascript
|
|
93
|
+
* const app = initializeApp(config);
|
|
94
|
+
* console.log(app.options.databaseURL === config.databaseURL); // true
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
readonly options: FirebaseOptions;
|
|
98
|
+
/**
|
|
99
|
+
* The settable config flag for GDPR opt-in/opt-out
|
|
100
|
+
*/
|
|
101
|
+
automaticDataCollectionEnabled: boolean;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* @public
|
|
105
|
+
*
|
|
106
|
+
* Firebase configuration object. Contains a set of parameters required by
|
|
107
|
+
* services in order to successfully communicate with Firebase server APIs
|
|
108
|
+
* and to associate client data with your Firebase project and
|
|
109
|
+
* Firebase application. Typically this object is populated by the Firebase
|
|
110
|
+
* console at project setup. See also:
|
|
111
|
+
* {@link https://firebase.google.com/docs/web/setup#config-object | Learn about the Firebase config object}.
|
|
112
|
+
*/
|
|
113
|
+
interface FirebaseOptions {
|
|
114
|
+
/**
|
|
115
|
+
* An encrypted string used when calling certain APIs that don't need to
|
|
116
|
+
* access private user data
|
|
117
|
+
* (example value: `AIzaSyDOCAbC123dEf456GhI789jKl012-MnO`).
|
|
118
|
+
*/
|
|
119
|
+
apiKey?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Auth domain for the project ID.
|
|
122
|
+
*/
|
|
123
|
+
authDomain?: string;
|
|
124
|
+
/**
|
|
125
|
+
* Default Realtime Database URL.
|
|
126
|
+
*/
|
|
127
|
+
databaseURL?: string;
|
|
128
|
+
/**
|
|
129
|
+
* The unique identifier for the project across all of Firebase and
|
|
130
|
+
* Google Cloud.
|
|
131
|
+
*/
|
|
132
|
+
projectId?: string;
|
|
133
|
+
/**
|
|
134
|
+
* The default Cloud Storage bucket name.
|
|
135
|
+
*/
|
|
136
|
+
storageBucket?: string;
|
|
137
|
+
/**
|
|
138
|
+
* Unique numerical value used to identify each sender that can send
|
|
139
|
+
* Firebase Cloud Messaging messages to client apps.
|
|
140
|
+
*/
|
|
141
|
+
messagingSenderId?: string;
|
|
142
|
+
/**
|
|
143
|
+
* Unique identifier for the app.
|
|
144
|
+
*/
|
|
145
|
+
appId?: string;
|
|
146
|
+
/**
|
|
147
|
+
* An ID automatically created when you enable Analytics in your
|
|
148
|
+
* Firebase project and register a web app. In versions 7.20.0
|
|
149
|
+
* and higher, this parameter is optional.
|
|
150
|
+
*/
|
|
151
|
+
measurementId?: string;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* @internal
|
|
155
|
+
*/
|
|
156
|
+
interface _FirebaseService {
|
|
157
|
+
app: FirebaseApp;
|
|
158
|
+
/**
|
|
159
|
+
* Delete the service and free it's resources - called from
|
|
160
|
+
* {@link @firebase/app#deleteApp | deleteApp()}
|
|
161
|
+
*/
|
|
162
|
+
_delete(): Promise<void>;
|
|
163
|
+
}
|
|
164
|
+
declare module '@firebase/component' {
|
|
165
|
+
interface NameServiceMapping {
|
|
166
|
+
'app': FirebaseApp;
|
|
167
|
+
'app-version': VersionService;
|
|
168
|
+
'heartbeat': HeartbeatService;
|
|
169
|
+
'platform-logger': PlatformLoggerService;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* An object that can be injected into the environment as __FIREBASE_DEFAULTS__,
|
|
175
|
+
* either as a property of globalThis, a shell environment variable, or a
|
|
176
|
+
* cookie.
|
|
177
|
+
*
|
|
178
|
+
* This object can be used to automatically configure and initialize
|
|
179
|
+
* a Firebase app as well as any emulators.
|
|
180
|
+
*
|
|
181
|
+
* @public
|
|
182
|
+
*/
|
|
183
|
+
interface FirebaseDefaults {
|
|
184
|
+
config?: Record<string, string>;
|
|
185
|
+
emulatorHosts?: Record<string, string>;
|
|
186
|
+
_authTokenSyncURL?: string;
|
|
187
|
+
_authIdTokenMaxAge?: number;
|
|
188
|
+
/**
|
|
189
|
+
* Override Firebase's runtime environment detection and
|
|
190
|
+
* force the SDK to act as if it were in the specified environment.
|
|
191
|
+
*/
|
|
192
|
+
forceEnvironment?: 'browser' | 'node';
|
|
193
|
+
[key: string]: unknown;
|
|
194
|
+
}
|
|
195
|
+
declare global {
|
|
196
|
+
var __FIREBASE_DEFAULTS__: FirebaseDefaults | undefined;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* @license
|
|
201
|
+
* Copyright 2020 Google LLC
|
|
202
|
+
*
|
|
203
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
204
|
+
* you may not use this file except in compliance with the License.
|
|
205
|
+
* You may obtain a copy of the License at
|
|
206
|
+
*
|
|
207
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
208
|
+
*
|
|
209
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
210
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
211
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
212
|
+
* See the License for the specific language governing permissions and
|
|
213
|
+
* limitations under the License.
|
|
214
|
+
*/
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Public interface of the Firebase Installations SDK.
|
|
218
|
+
*
|
|
219
|
+
* @public
|
|
220
|
+
*/
|
|
221
|
+
interface Installations {
|
|
222
|
+
/**
|
|
223
|
+
* The {@link @firebase/app#FirebaseApp} this `Installations` instance is associated with.
|
|
224
|
+
*/
|
|
225
|
+
app: FirebaseApp;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* An interface for Firebase internal SDKs use only.
|
|
229
|
+
*
|
|
230
|
+
* @internal
|
|
231
|
+
*/
|
|
232
|
+
interface _FirebaseInstallationsInternal {
|
|
233
|
+
/**
|
|
234
|
+
* Creates a Firebase Installation if there isn't one for the app and
|
|
235
|
+
* returns the Installation ID.
|
|
236
|
+
*/
|
|
237
|
+
getId(): Promise<string>;
|
|
238
|
+
/**
|
|
239
|
+
* Returns an Authentication Token for the current Firebase Installation.
|
|
240
|
+
*/
|
|
241
|
+
getToken(forceRefresh?: boolean): Promise<string>;
|
|
242
|
+
}
|
|
243
|
+
declare module '@firebase/component' {
|
|
244
|
+
interface NameServiceMapping {
|
|
245
|
+
'installations': Installations;
|
|
246
|
+
'installations-internal': _FirebaseInstallationsInternal;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* @license
|
|
252
|
+
* Copyright 2019 Google LLC
|
|
253
|
+
*
|
|
254
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
255
|
+
* you may not use this file except in compliance with the License.
|
|
256
|
+
* You may obtain a copy of the License at
|
|
257
|
+
*
|
|
258
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
259
|
+
*
|
|
260
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
261
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
262
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
263
|
+
* See the License for the specific language governing permissions and
|
|
264
|
+
* limitations under the License.
|
|
265
|
+
*/
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* A set of common Google Analytics config settings recognized by
|
|
269
|
+
* `gtag.js`.
|
|
270
|
+
* @public
|
|
271
|
+
*/
|
|
272
|
+
interface GtagConfigParams {
|
|
273
|
+
/**
|
|
274
|
+
* Whether or not a page view should be sent.
|
|
275
|
+
* If set to true (default), a page view is automatically sent upon initialization
|
|
276
|
+
* of analytics.
|
|
277
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views }
|
|
278
|
+
*/
|
|
279
|
+
'send_page_view'?: boolean;
|
|
280
|
+
/**
|
|
281
|
+
* The title of the page.
|
|
282
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views }
|
|
283
|
+
*/
|
|
284
|
+
'page_title'?: string;
|
|
285
|
+
/**
|
|
286
|
+
* The URL of the page.
|
|
287
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views }
|
|
288
|
+
*/
|
|
289
|
+
'page_location'?: string;
|
|
290
|
+
/**
|
|
291
|
+
* Defaults to `auto`.
|
|
292
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
|
|
293
|
+
*/
|
|
294
|
+
'cookie_domain'?: string;
|
|
295
|
+
/**
|
|
296
|
+
* Defaults to 63072000 (two years, in seconds).
|
|
297
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
|
|
298
|
+
*/
|
|
299
|
+
'cookie_expires'?: number;
|
|
300
|
+
/**
|
|
301
|
+
* Defaults to `_ga`.
|
|
302
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
|
|
303
|
+
*/
|
|
304
|
+
'cookie_prefix'?: string;
|
|
305
|
+
/**
|
|
306
|
+
* If set to true, will update cookies on each page load.
|
|
307
|
+
* Defaults to true.
|
|
308
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
|
|
309
|
+
*/
|
|
310
|
+
'cookie_update'?: boolean;
|
|
311
|
+
/**
|
|
312
|
+
* Appends additional flags to the cookie when set.
|
|
313
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
|
|
314
|
+
*/
|
|
315
|
+
'cookie_flags'?: string;
|
|
316
|
+
/**
|
|
317
|
+
* If set to false, disables all advertising features with `gtag.js`.
|
|
318
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features }
|
|
319
|
+
*/
|
|
320
|
+
'allow_google_signals'?: boolean;
|
|
321
|
+
/**
|
|
322
|
+
* If set to false, disables all advertising personalization with `gtag.js`.
|
|
323
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features }
|
|
324
|
+
*/
|
|
325
|
+
'allow_ad_personalization_signals'?: boolean;
|
|
326
|
+
[key: string]: unknown;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* {@link Analytics} instance initialization options.
|
|
330
|
+
* @public
|
|
331
|
+
*/
|
|
332
|
+
interface AnalyticsSettings {
|
|
333
|
+
/**
|
|
334
|
+
* Params to be passed in the initial `gtag` config call during Firebase
|
|
335
|
+
* Analytics initialization.
|
|
336
|
+
*/
|
|
337
|
+
config?: GtagConfigParams | EventParams;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Additional options that can be passed to Analytics method
|
|
341
|
+
* calls such as `logEvent`, etc.
|
|
342
|
+
* @public
|
|
343
|
+
*/
|
|
344
|
+
interface AnalyticsCallOptions {
|
|
345
|
+
/**
|
|
346
|
+
* If true, this config or event call applies globally to all
|
|
347
|
+
* Google Analytics properties on the page.
|
|
348
|
+
*/
|
|
349
|
+
global: boolean;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* An instance of Firebase Analytics.
|
|
353
|
+
* @public
|
|
354
|
+
*/
|
|
355
|
+
interface Analytics {
|
|
356
|
+
/**
|
|
357
|
+
* The {@link @firebase/app#FirebaseApp} this {@link Analytics} instance is associated with.
|
|
358
|
+
*/
|
|
359
|
+
app: FirebaseApp;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Specifies custom options for your Firebase Analytics instance.
|
|
363
|
+
* You must set these before initializing `firebase.analytics()`.
|
|
364
|
+
* @public
|
|
365
|
+
*/
|
|
366
|
+
interface SettingsOptions {
|
|
367
|
+
/** Sets custom name for `gtag` function. */
|
|
368
|
+
gtagName?: string;
|
|
369
|
+
/** Sets custom name for `dataLayer` array used by `gtag.js`. */
|
|
370
|
+
dataLayerName?: string;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Any custom params the user may pass to `gtag`.
|
|
374
|
+
* @public
|
|
375
|
+
*/
|
|
376
|
+
interface CustomParams {
|
|
377
|
+
[key: string]: unknown;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Type for standard Google Analytics event names. `logEvent` also accepts any
|
|
381
|
+
* custom string and interprets it as a custom event name.
|
|
382
|
+
* @public
|
|
383
|
+
*/
|
|
384
|
+
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';
|
|
385
|
+
/**
|
|
386
|
+
* Standard Google Analytics currency type.
|
|
387
|
+
* @public
|
|
388
|
+
*/
|
|
389
|
+
type Currency = string | number;
|
|
390
|
+
/**
|
|
391
|
+
* Standard Google Analytics `Item` type.
|
|
392
|
+
* @public
|
|
393
|
+
*/
|
|
394
|
+
interface Item {
|
|
395
|
+
item_id?: string;
|
|
396
|
+
item_name?: string;
|
|
397
|
+
item_brand?: string;
|
|
398
|
+
item_category?: string;
|
|
399
|
+
item_category2?: string;
|
|
400
|
+
item_category3?: string;
|
|
401
|
+
item_category4?: string;
|
|
402
|
+
item_category5?: string;
|
|
403
|
+
item_variant?: string;
|
|
404
|
+
price?: Currency;
|
|
405
|
+
quantity?: number;
|
|
406
|
+
index?: number;
|
|
407
|
+
coupon?: string;
|
|
408
|
+
item_list_name?: string;
|
|
409
|
+
item_list_id?: string;
|
|
410
|
+
discount?: Currency;
|
|
411
|
+
affiliation?: string;
|
|
412
|
+
creative_name?: string;
|
|
413
|
+
creative_slot?: string;
|
|
414
|
+
promotion_id?: string;
|
|
415
|
+
promotion_name?: string;
|
|
416
|
+
location_id?: string;
|
|
417
|
+
/** @deprecated Use item_brand instead. */
|
|
418
|
+
brand?: string;
|
|
419
|
+
/** @deprecated Use item_category instead. */
|
|
420
|
+
category?: string;
|
|
421
|
+
/** @deprecated Use item_id instead. */
|
|
422
|
+
id?: string;
|
|
423
|
+
/** @deprecated Use item_name instead. */
|
|
424
|
+
name?: string;
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Field previously used by some Google Analytics events.
|
|
428
|
+
* @deprecated Use `Item` instead.
|
|
429
|
+
* @public
|
|
430
|
+
*/
|
|
431
|
+
interface Promotion {
|
|
432
|
+
creative_name?: string;
|
|
433
|
+
creative_slot?: string;
|
|
434
|
+
id?: string;
|
|
435
|
+
name?: string;
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Standard `gtag.js` control parameters.
|
|
439
|
+
* For more information, see
|
|
440
|
+
* {@link https://developers.google.com/gtagjs/reference/ga4-events
|
|
441
|
+
* | the GA4 reference documentation}.
|
|
442
|
+
* @public
|
|
443
|
+
*/
|
|
444
|
+
interface ControlParams {
|
|
445
|
+
groups?: string | string[];
|
|
446
|
+
send_to?: string | string[];
|
|
447
|
+
event_callback?: () => void;
|
|
448
|
+
event_timeout?: number;
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Standard `gtag.js` event parameters.
|
|
452
|
+
* For more information, see
|
|
453
|
+
* {@link https://developers.google.com/gtagjs/reference/ga4-events
|
|
454
|
+
* | the GA4 reference documentation}.
|
|
455
|
+
* @public
|
|
456
|
+
*/
|
|
457
|
+
interface EventParams {
|
|
458
|
+
checkout_option?: string;
|
|
459
|
+
checkout_step?: number;
|
|
460
|
+
item_id?: string;
|
|
461
|
+
content_type?: string;
|
|
462
|
+
coupon?: string;
|
|
463
|
+
currency?: string;
|
|
464
|
+
description?: string;
|
|
465
|
+
fatal?: boolean;
|
|
466
|
+
items?: Item[];
|
|
467
|
+
method?: string;
|
|
468
|
+
number?: string;
|
|
469
|
+
promotions?: Promotion[];
|
|
470
|
+
screen_name?: string;
|
|
471
|
+
/**
|
|
472
|
+
* Firebase-specific. Use to log a `screen_name` to Firebase Analytics.
|
|
473
|
+
*/
|
|
474
|
+
firebase_screen?: string;
|
|
475
|
+
/**
|
|
476
|
+
* Firebase-specific. Use to log a `screen_class` to Firebase Analytics.
|
|
477
|
+
*/
|
|
478
|
+
firebase_screen_class?: string;
|
|
479
|
+
search_term?: string;
|
|
480
|
+
shipping?: Currency;
|
|
481
|
+
tax?: Currency;
|
|
482
|
+
transaction_id?: string;
|
|
483
|
+
value?: number;
|
|
484
|
+
event_label?: string;
|
|
485
|
+
event_category?: string;
|
|
486
|
+
shipping_tier?: string;
|
|
487
|
+
item_list_id?: string;
|
|
488
|
+
item_list_name?: string;
|
|
489
|
+
promotion_id?: string;
|
|
490
|
+
promotion_name?: string;
|
|
491
|
+
payment_type?: string;
|
|
492
|
+
affiliation?: string;
|
|
493
|
+
page_title?: string;
|
|
494
|
+
page_location?: string;
|
|
495
|
+
page_path?: string;
|
|
496
|
+
[key: string]: unknown;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Consent status settings for each consent type.
|
|
500
|
+
* For more information, see
|
|
501
|
+
* {@link https://developers.google.com/tag-platform/tag-manager/templates/consent-apis
|
|
502
|
+
* | the GA4 reference documentation for consent state and consent types}.
|
|
503
|
+
* @public
|
|
504
|
+
*/
|
|
505
|
+
interface ConsentSettings {
|
|
506
|
+
/** Enables storage, such as cookies, related to advertising */
|
|
507
|
+
ad_storage?: ConsentStatusString;
|
|
508
|
+
/** Sets consent for sending user data to Google for advertising purposes. */
|
|
509
|
+
ad_user_data?: ConsentStatusString;
|
|
510
|
+
/** Sets consent for personalized advertising. */
|
|
511
|
+
ad_personalization?: ConsentStatusString;
|
|
512
|
+
/** Enables storage, such as cookies, related to analytics (for example, visit duration) */
|
|
513
|
+
analytics_storage?: ConsentStatusString;
|
|
514
|
+
/**
|
|
515
|
+
* Enables storage that supports the functionality of the website or app such as language settings
|
|
516
|
+
*/
|
|
517
|
+
functionality_storage?: ConsentStatusString;
|
|
518
|
+
/** Enables storage related to personalization such as video recommendations */
|
|
519
|
+
personalization_storage?: ConsentStatusString;
|
|
520
|
+
/**
|
|
521
|
+
* Enables storage related to security such as authentication functionality, fraud prevention,
|
|
522
|
+
* and other user protection.
|
|
523
|
+
*/
|
|
524
|
+
security_storage?: ConsentStatusString;
|
|
525
|
+
[key: string]: unknown;
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Whether a particular consent type has been granted or denied.
|
|
529
|
+
* @public
|
|
530
|
+
*/
|
|
531
|
+
type ConsentStatusString = 'granted' | 'denied';
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* @license
|
|
535
|
+
* Copyright 2019 Google LLC
|
|
536
|
+
*
|
|
537
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
538
|
+
* you may not use this file except in compliance with the License.
|
|
539
|
+
* You may obtain a copy of the License at
|
|
540
|
+
*
|
|
541
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
542
|
+
*
|
|
543
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
544
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
545
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
546
|
+
* See the License for the specific language governing permissions and
|
|
547
|
+
* limitations under the License.
|
|
548
|
+
*/
|
|
549
|
+
/**
|
|
550
|
+
* Type constant for Firebase Analytics.
|
|
551
|
+
*/
|
|
552
|
+
declare const ANALYTICS_TYPE = "analytics";
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* @license
|
|
556
|
+
* Copyright 2019 Google LLC
|
|
557
|
+
*
|
|
558
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
559
|
+
* you may not use this file except in compliance with the License.
|
|
560
|
+
* You may obtain a copy of the License at
|
|
561
|
+
*
|
|
562
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
563
|
+
*
|
|
564
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
565
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
566
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
567
|
+
* See the License for the specific language governing permissions and
|
|
568
|
+
* limitations under the License.
|
|
569
|
+
*/
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* Analytics Service class.
|
|
573
|
+
*/
|
|
574
|
+
declare class AnalyticsService implements Analytics, _FirebaseService {
|
|
575
|
+
app: FirebaseApp;
|
|
576
|
+
constructor(app: FirebaseApp);
|
|
577
|
+
_delete(): Promise<void>;
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Configures Firebase Analytics to use custom `gtag` or `dataLayer` names.
|
|
581
|
+
* Intended to be used if `gtag.js` script has been installed on
|
|
582
|
+
* this page independently of Firebase Analytics, and is using non-default
|
|
583
|
+
* names for either the `gtag` function or for `dataLayer`.
|
|
584
|
+
* Must be called before calling `getAnalytics()` or it won't
|
|
585
|
+
* have any effect.
|
|
586
|
+
*
|
|
587
|
+
* @public
|
|
588
|
+
*
|
|
589
|
+
* @param options - Custom gtag and dataLayer names.
|
|
590
|
+
*/
|
|
591
|
+
declare function settings(options: SettingsOptions): void;
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* @license
|
|
595
|
+
* Copyright 2020 Google LLC
|
|
596
|
+
*
|
|
597
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
598
|
+
* you may not use this file except in compliance with the License.
|
|
599
|
+
* You may obtain a copy of the License at
|
|
600
|
+
*
|
|
601
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
602
|
+
*
|
|
603
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
604
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
605
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
606
|
+
* See the License for the specific language governing permissions and
|
|
607
|
+
* limitations under the License.
|
|
608
|
+
*/
|
|
609
|
+
|
|
610
|
+
declare module '@firebase/component' {
|
|
611
|
+
interface NameServiceMapping {
|
|
612
|
+
[ANALYTICS_TYPE]: AnalyticsService;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Returns an {@link Analytics} instance for the given app.
|
|
617
|
+
*
|
|
618
|
+
* @public
|
|
619
|
+
*
|
|
620
|
+
* @param app - The {@link @firebase/app#FirebaseApp} to use.
|
|
621
|
+
*/
|
|
622
|
+
declare function getAnalytics(app?: FirebaseApp): Analytics;
|
|
623
|
+
/**
|
|
624
|
+
* Returns an {@link Analytics} instance for the given app.
|
|
625
|
+
*
|
|
626
|
+
* @public
|
|
627
|
+
*
|
|
628
|
+
* @param app - The {@link @firebase/app#FirebaseApp} to use.
|
|
629
|
+
*/
|
|
630
|
+
declare function initializeAnalytics(app: FirebaseApp, options?: AnalyticsSettings): Analytics;
|
|
631
|
+
/**
|
|
632
|
+
* This is a public static method provided to users that wraps four different checks:
|
|
633
|
+
*
|
|
634
|
+
* 1. Check if it's not a browser extension environment.
|
|
635
|
+
* 2. Check if cookies are enabled in current browser.
|
|
636
|
+
* 3. Check if IndexedDB is supported by the browser environment.
|
|
637
|
+
* 4. Check if the current browser context is valid for using `IndexedDB.open()`.
|
|
638
|
+
*
|
|
639
|
+
* @public
|
|
640
|
+
*
|
|
641
|
+
*/
|
|
642
|
+
declare function isSupported(): Promise<boolean>;
|
|
643
|
+
/**
|
|
644
|
+
* Use gtag `config` command to set `screen_name`.
|
|
645
|
+
*
|
|
646
|
+
* @public
|
|
647
|
+
*
|
|
648
|
+
* @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`.
|
|
649
|
+
* See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}.
|
|
650
|
+
*
|
|
651
|
+
* @param analyticsInstance - The {@link Analytics} instance.
|
|
652
|
+
* @param screenName - Screen name to set.
|
|
653
|
+
*/
|
|
654
|
+
declare function setCurrentScreen(analyticsInstance: Analytics, screenName: string, options?: AnalyticsCallOptions): void;
|
|
655
|
+
/**
|
|
656
|
+
* Retrieves a unique Google Analytics identifier for the web client.
|
|
657
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/reference/config#client_id | client_id}.
|
|
658
|
+
*
|
|
659
|
+
* @public
|
|
660
|
+
*
|
|
661
|
+
* @param app - The {@link @firebase/app#FirebaseApp} to use.
|
|
662
|
+
*/
|
|
663
|
+
declare function getGoogleAnalyticsClientId(analyticsInstance: Analytics): Promise<string>;
|
|
664
|
+
/**
|
|
665
|
+
* Use gtag `config` command to set `user_id`.
|
|
666
|
+
*
|
|
667
|
+
* @public
|
|
668
|
+
*
|
|
669
|
+
* @param analyticsInstance - The {@link Analytics} instance.
|
|
670
|
+
* @param id - User ID to set.
|
|
671
|
+
*/
|
|
672
|
+
declare function setUserId(analyticsInstance: Analytics, id: string | null, options?: AnalyticsCallOptions): void;
|
|
673
|
+
/**
|
|
674
|
+
* Use gtag `config` command to set all params specified.
|
|
675
|
+
*
|
|
676
|
+
* @public
|
|
677
|
+
*/
|
|
678
|
+
declare function setUserProperties(analyticsInstance: Analytics, properties: CustomParams, options?: AnalyticsCallOptions): void;
|
|
679
|
+
/**
|
|
680
|
+
* Sets whether Google Analytics collection is enabled for this app on this device.
|
|
681
|
+
* Sets global `window['ga-disable-analyticsId'] = true;`
|
|
682
|
+
*
|
|
683
|
+
* @public
|
|
684
|
+
*
|
|
685
|
+
* @param analyticsInstance - The {@link Analytics} instance.
|
|
686
|
+
* @param enabled - If true, enables collection, if false, disables it.
|
|
687
|
+
*/
|
|
688
|
+
declare function setAnalyticsCollectionEnabled(analyticsInstance: Analytics, enabled: boolean): void;
|
|
689
|
+
/**
|
|
690
|
+
* Adds data that will be set on every event logged from the SDK, including automatic ones.
|
|
691
|
+
* With gtag's "set" command, the values passed persist on the current page and are passed with
|
|
692
|
+
* all subsequent events.
|
|
693
|
+
* @public
|
|
694
|
+
* @param customParams - Any custom params the user may pass to gtag.js.
|
|
695
|
+
*/
|
|
696
|
+
declare function setDefaultEventParameters(customParams: CustomParams): void;
|
|
697
|
+
/**
|
|
698
|
+
* Sends a Google Analytics event with given `eventParams`. This method
|
|
699
|
+
* automatically associates this logged event with this Firebase web
|
|
700
|
+
* app instance on this device.
|
|
701
|
+
* @public
|
|
702
|
+
* List of recommended event parameters can be found in
|
|
703
|
+
* {@link https://developers.google.com/gtagjs/reference/ga4-events
|
|
704
|
+
* | the GA4 reference documentation}.
|
|
705
|
+
*/
|
|
706
|
+
declare function logEvent(analyticsInstance: Analytics, eventName: 'add_payment_info', eventParams?: {
|
|
707
|
+
coupon?: EventParams['coupon'];
|
|
708
|
+
currency?: EventParams['currency'];
|
|
709
|
+
items?: EventParams['items'];
|
|
710
|
+
payment_type?: EventParams['payment_type'];
|
|
711
|
+
value?: EventParams['value'];
|
|
712
|
+
[key: string]: any;
|
|
713
|
+
}, options?: AnalyticsCallOptions): void;
|
|
714
|
+
/**
|
|
715
|
+
* Sends a Google Analytics event with given `eventParams`. This method
|
|
716
|
+
* automatically associates this logged event with this Firebase web
|
|
717
|
+
* app instance on this device.
|
|
718
|
+
* @public
|
|
719
|
+
* List of recommended event parameters can be found in
|
|
720
|
+
* {@link https://developers.google.com/gtagjs/reference/ga4-events
|
|
721
|
+
* | the GA4 reference documentation}.
|
|
722
|
+
*/
|
|
723
|
+
declare function logEvent(analyticsInstance: Analytics, eventName: 'add_shipping_info', eventParams?: {
|
|
724
|
+
coupon?: EventParams['coupon'];
|
|
725
|
+
currency?: EventParams['currency'];
|
|
726
|
+
items?: EventParams['items'];
|
|
727
|
+
shipping_tier?: EventParams['shipping_tier'];
|
|
728
|
+
value?: EventParams['value'];
|
|
729
|
+
[key: string]: any;
|
|
730
|
+
}, options?: AnalyticsCallOptions): void;
|
|
731
|
+
/**
|
|
732
|
+
* Sends a Google Analytics event with given `eventParams`. This method
|
|
733
|
+
* automatically associates this logged event with this Firebase web
|
|
734
|
+
* app instance on this device.
|
|
735
|
+
* @public
|
|
736
|
+
* List of recommended event parameters can be found in
|
|
737
|
+
* {@link https://developers.google.com/gtagjs/reference/ga4-events
|
|
738
|
+
* | the GA4 reference documentation}.
|
|
739
|
+
*/
|
|
740
|
+
declare function logEvent(analyticsInstance: Analytics, eventName: 'add_to_cart' | 'add_to_wishlist' | 'remove_from_cart', eventParams?: {
|
|
741
|
+
currency?: EventParams['currency'];
|
|
742
|
+
value?: EventParams['value'];
|
|
743
|
+
items?: EventParams['items'];
|
|
744
|
+
[key: string]: any;
|
|
745
|
+
}, options?: AnalyticsCallOptions): void;
|
|
746
|
+
/**
|
|
747
|
+
* Sends a Google Analytics event with given `eventParams`. This method
|
|
748
|
+
* automatically associates this logged event with this Firebase web
|
|
749
|
+
* app instance on this device.
|
|
750
|
+
* @public
|
|
751
|
+
* List of recommended event parameters can be found in
|
|
752
|
+
* {@link https://developers.google.com/gtagjs/reference/ga4-events
|
|
753
|
+
* | the GA4 reference documentation}.
|
|
754
|
+
*/
|
|
755
|
+
declare function logEvent(analyticsInstance: Analytics, eventName: 'begin_checkout', eventParams?: {
|
|
756
|
+
currency?: EventParams['currency'];
|
|
757
|
+
coupon?: EventParams['coupon'];
|
|
758
|
+
value?: EventParams['value'];
|
|
759
|
+
items?: EventParams['items'];
|
|
760
|
+
[key: string]: any;
|
|
761
|
+
}, options?: AnalyticsCallOptions): void;
|
|
762
|
+
/**
|
|
763
|
+
* Sends a Google Analytics event with given `eventParams`. This method
|
|
764
|
+
* automatically associates this logged event with this Firebase web
|
|
765
|
+
* app instance on this device.
|
|
766
|
+
* @public
|
|
767
|
+
* List of recommended event parameters can be found in
|
|
768
|
+
* {@link https://developers.google.com/gtagjs/reference/ga4-events
|
|
769
|
+
* | the GA4 reference documentation}.
|
|
770
|
+
*/
|
|
771
|
+
declare function logEvent(analyticsInstance: Analytics, eventName: 'checkout_progress', eventParams?: {
|
|
772
|
+
currency?: EventParams['currency'];
|
|
773
|
+
coupon?: EventParams['coupon'];
|
|
774
|
+
value?: EventParams['value'];
|
|
775
|
+
items?: EventParams['items'];
|
|
776
|
+
checkout_step?: EventParams['checkout_step'];
|
|
777
|
+
checkout_option?: EventParams['checkout_option'];
|
|
778
|
+
[key: string]: any;
|
|
779
|
+
}, options?: AnalyticsCallOptions): void;
|
|
780
|
+
/**
|
|
781
|
+
* Sends a Google Analytics event with given `eventParams`. This method
|
|
782
|
+
* automatically associates this logged event with this Firebase web
|
|
783
|
+
* app instance on this device.
|
|
784
|
+
* @public
|
|
785
|
+
* See
|
|
786
|
+
* {@link https://developers.google.com/analytics/devguides/collection/ga4/exceptions
|
|
787
|
+
* | Measure exceptions}.
|
|
788
|
+
*/
|
|
789
|
+
declare function logEvent(analyticsInstance: Analytics, eventName: 'exception', eventParams?: {
|
|
790
|
+
description?: EventParams['description'];
|
|
791
|
+
fatal?: EventParams['fatal'];
|
|
792
|
+
[key: string]: any;
|
|
793
|
+
}, options?: AnalyticsCallOptions): void;
|
|
794
|
+
/**
|
|
795
|
+
* Sends a Google Analytics event with given `eventParams`. This method
|
|
796
|
+
* automatically associates this logged event with this Firebase web
|
|
797
|
+
* app instance on this device.
|
|
798
|
+
* @public
|
|
799
|
+
* List of recommended event parameters can be found in
|
|
800
|
+
* {@link https://developers.google.com/gtagjs/reference/ga4-events
|
|
801
|
+
* | the GA4 reference documentation}.
|
|
802
|
+
*/
|
|
803
|
+
declare function logEvent(analyticsInstance: Analytics, eventName: 'generate_lead', eventParams?: {
|
|
804
|
+
value?: EventParams['value'];
|
|
805
|
+
currency?: EventParams['currency'];
|
|
806
|
+
[key: string]: any;
|
|
807
|
+
}, options?: AnalyticsCallOptions): void;
|
|
808
|
+
/**
|
|
809
|
+
* Sends a Google Analytics event with given `eventParams`. This method
|
|
810
|
+
* automatically associates this logged event with this Firebase web
|
|
811
|
+
* app instance on this device.
|
|
812
|
+
* @public
|
|
813
|
+
* List of recommended event parameters can be found in
|
|
814
|
+
* {@link https://developers.google.com/gtagjs/reference/ga4-events
|
|
815
|
+
* | the GA4 reference documentation}.
|
|
816
|
+
*/
|
|
817
|
+
declare function logEvent(analyticsInstance: Analytics, eventName: 'login', eventParams?: {
|
|
818
|
+
method?: EventParams['method'];
|
|
819
|
+
[key: string]: any;
|
|
820
|
+
}, options?: AnalyticsCallOptions): void;
|
|
821
|
+
/**
|
|
822
|
+
* Sends a Google Analytics event with given `eventParams`. This method
|
|
823
|
+
* automatically associates this logged event with this Firebase web
|
|
824
|
+
* app instance on this device.
|
|
825
|
+
* @public
|
|
826
|
+
* See
|
|
827
|
+
* {@link https://developers.google.com/analytics/devguides/collection/ga4/views
|
|
828
|
+
* | Page views}.
|
|
829
|
+
*/
|
|
830
|
+
declare function logEvent(analyticsInstance: Analytics, eventName: 'page_view', eventParams?: {
|
|
831
|
+
page_title?: string;
|
|
832
|
+
page_location?: string;
|
|
833
|
+
page_path?: string;
|
|
834
|
+
[key: string]: any;
|
|
835
|
+
}, options?: AnalyticsCallOptions): void;
|
|
836
|
+
/**
|
|
837
|
+
* Sends a Google Analytics event with given `eventParams`. This method
|
|
838
|
+
* automatically associates this logged event with this Firebase web
|
|
839
|
+
* app instance on this device.
|
|
840
|
+
* @public
|
|
841
|
+
* List of recommended event parameters can be found in
|
|
842
|
+
* {@link https://developers.google.com/gtagjs/reference/ga4-events
|
|
843
|
+
* | the GA4 reference documentation}.
|
|
844
|
+
*/
|
|
845
|
+
declare function logEvent(analyticsInstance: Analytics, eventName: 'purchase' | 'refund', eventParams?: {
|
|
846
|
+
value?: EventParams['value'];
|
|
847
|
+
currency?: EventParams['currency'];
|
|
848
|
+
transaction_id: EventParams['transaction_id'];
|
|
849
|
+
tax?: EventParams['tax'];
|
|
850
|
+
shipping?: EventParams['shipping'];
|
|
851
|
+
items?: EventParams['items'];
|
|
852
|
+
coupon?: EventParams['coupon'];
|
|
853
|
+
affiliation?: EventParams['affiliation'];
|
|
854
|
+
[key: string]: any;
|
|
855
|
+
}, options?: AnalyticsCallOptions): void;
|
|
856
|
+
/**
|
|
857
|
+
* Sends a Google Analytics event with given `eventParams`. This method
|
|
858
|
+
* automatically associates this logged event with this Firebase web
|
|
859
|
+
* app instance on this device.
|
|
860
|
+
* @public
|
|
861
|
+
* See {@link https://firebase.google.com/docs/analytics/screenviews
|
|
862
|
+
* | Track Screenviews}.
|
|
863
|
+
*/
|
|
864
|
+
declare function logEvent(analyticsInstance: Analytics, eventName: 'screen_view', eventParams?: {
|
|
865
|
+
firebase_screen: EventParams['firebase_screen'];
|
|
866
|
+
firebase_screen_class: EventParams['firebase_screen_class'];
|
|
867
|
+
[key: string]: any;
|
|
868
|
+
}, options?: AnalyticsCallOptions): void;
|
|
869
|
+
/**
|
|
870
|
+
* Sends a Google Analytics event with given `eventParams`. This method
|
|
871
|
+
* automatically associates this logged event with this Firebase web
|
|
872
|
+
* app instance on this device.
|
|
873
|
+
* @public
|
|
874
|
+
* List of recommended event parameters can be found in
|
|
875
|
+
* {@link https://developers.google.com/gtagjs/reference/ga4-events
|
|
876
|
+
* | the GA4 reference documentation}.
|
|
877
|
+
*/
|
|
878
|
+
declare function logEvent(analyticsInstance: Analytics, eventName: 'search' | 'view_search_results', eventParams?: {
|
|
879
|
+
search_term?: EventParams['search_term'];
|
|
880
|
+
[key: string]: any;
|
|
881
|
+
}, options?: AnalyticsCallOptions): void;
|
|
882
|
+
/**
|
|
883
|
+
* Sends a Google Analytics event with given `eventParams`. This method
|
|
884
|
+
* automatically associates this logged event with this Firebase web
|
|
885
|
+
* app instance on this device.
|
|
886
|
+
* @public
|
|
887
|
+
* List of recommended event parameters can be found in
|
|
888
|
+
* {@link https://developers.google.com/gtagjs/reference/ga4-events
|
|
889
|
+
* | the GA4 reference documentation}.
|
|
890
|
+
*/
|
|
891
|
+
declare function logEvent(analyticsInstance: Analytics, eventName: 'select_content', eventParams?: {
|
|
892
|
+
content_type?: EventParams['content_type'];
|
|
893
|
+
item_id?: EventParams['item_id'];
|
|
894
|
+
[key: string]: any;
|
|
895
|
+
}, options?: AnalyticsCallOptions): void;
|
|
896
|
+
/**
|
|
897
|
+
* Sends a Google Analytics event with given `eventParams`. This method
|
|
898
|
+
* automatically associates this logged event with this Firebase web
|
|
899
|
+
* app instance on this device.
|
|
900
|
+
* @public
|
|
901
|
+
* List of recommended event parameters can be found in
|
|
902
|
+
* {@link https://developers.google.com/gtagjs/reference/ga4-events
|
|
903
|
+
* | the GA4 reference documentation}.
|
|
904
|
+
*/
|
|
905
|
+
declare function logEvent(analyticsInstance: Analytics, eventName: 'select_item', eventParams?: {
|
|
906
|
+
items?: EventParams['items'];
|
|
907
|
+
item_list_name?: EventParams['item_list_name'];
|
|
908
|
+
item_list_id?: EventParams['item_list_id'];
|
|
909
|
+
[key: string]: any;
|
|
910
|
+
}, options?: AnalyticsCallOptions): void;
|
|
911
|
+
/**
|
|
912
|
+
* Sends a Google Analytics event with given `eventParams`. This method
|
|
913
|
+
* automatically associates this logged event with this Firebase web
|
|
914
|
+
* app instance on this device.
|
|
915
|
+
* @public
|
|
916
|
+
* List of recommended event parameters can be found in
|
|
917
|
+
* {@link https://developers.google.com/gtagjs/reference/ga4-events
|
|
918
|
+
* | the GA4 reference documentation}.
|
|
919
|
+
*/
|
|
920
|
+
declare function logEvent(analyticsInstance: Analytics, eventName: 'select_promotion' | 'view_promotion', eventParams?: {
|
|
921
|
+
items?: EventParams['items'];
|
|
922
|
+
promotion_id?: EventParams['promotion_id'];
|
|
923
|
+
promotion_name?: EventParams['promotion_name'];
|
|
924
|
+
[key: string]: any;
|
|
925
|
+
}, options?: AnalyticsCallOptions): void;
|
|
926
|
+
/**
|
|
927
|
+
* Sends a Google Analytics event with given `eventParams`. This method
|
|
928
|
+
* automatically associates this logged event with this Firebase web
|
|
929
|
+
* app instance on this device.
|
|
930
|
+
* @public
|
|
931
|
+
* List of recommended event parameters can be found in
|
|
932
|
+
* {@link https://developers.google.com/gtagjs/reference/ga4-events
|
|
933
|
+
* | the GA4 reference documentation}.
|
|
934
|
+
*/
|
|
935
|
+
declare function logEvent(analyticsInstance: Analytics, eventName: 'set_checkout_option', eventParams?: {
|
|
936
|
+
checkout_step?: EventParams['checkout_step'];
|
|
937
|
+
checkout_option?: EventParams['checkout_option'];
|
|
938
|
+
[key: string]: any;
|
|
939
|
+
}, options?: AnalyticsCallOptions): void;
|
|
940
|
+
/**
|
|
941
|
+
* Sends a Google Analytics event with given `eventParams`. This method
|
|
942
|
+
* automatically associates this logged event with this Firebase web
|
|
943
|
+
* app instance on this device.
|
|
944
|
+
* @public
|
|
945
|
+
* List of recommended event parameters can be found in
|
|
946
|
+
* {@link https://developers.google.com/gtagjs/reference/ga4-events
|
|
947
|
+
* | the GA4 reference documentation}.
|
|
948
|
+
*/
|
|
949
|
+
declare function logEvent(analyticsInstance: Analytics, eventName: 'share', eventParams?: {
|
|
950
|
+
method?: EventParams['method'];
|
|
951
|
+
content_type?: EventParams['content_type'];
|
|
952
|
+
item_id?: EventParams['item_id'];
|
|
953
|
+
[key: string]: any;
|
|
954
|
+
}, options?: AnalyticsCallOptions): void;
|
|
955
|
+
/**
|
|
956
|
+
* Sends a Google Analytics event with given `eventParams`. This method
|
|
957
|
+
* automatically associates this logged event with this Firebase web
|
|
958
|
+
* app instance on this device.
|
|
959
|
+
* @public
|
|
960
|
+
* List of recommended event parameters can be found in
|
|
961
|
+
* {@link https://developers.google.com/gtagjs/reference/ga4-events
|
|
962
|
+
* | the GA4 reference documentation}.
|
|
963
|
+
*/
|
|
964
|
+
declare function logEvent(analyticsInstance: Analytics, eventName: 'sign_up', eventParams?: {
|
|
965
|
+
method?: EventParams['method'];
|
|
966
|
+
[key: string]: any;
|
|
967
|
+
}, options?: AnalyticsCallOptions): void;
|
|
968
|
+
/**
|
|
969
|
+
* Sends a Google Analytics event with given `eventParams`. This method
|
|
970
|
+
* automatically associates this logged event with this Firebase web
|
|
971
|
+
* app instance on this device.
|
|
972
|
+
* @public
|
|
973
|
+
* List of recommended event parameters can be found in
|
|
974
|
+
* {@link https://developers.google.com/gtagjs/reference/ga4-events
|
|
975
|
+
* | the GA4 reference documentation}.
|
|
976
|
+
*/
|
|
977
|
+
declare function logEvent(analyticsInstance: Analytics, eventName: 'timing_complete', eventParams?: {
|
|
978
|
+
name: string;
|
|
979
|
+
value: number;
|
|
980
|
+
event_category?: string;
|
|
981
|
+
event_label?: string;
|
|
982
|
+
[key: string]: any;
|
|
983
|
+
}, options?: AnalyticsCallOptions): void;
|
|
984
|
+
/**
|
|
985
|
+
* Sends a Google Analytics event with given `eventParams`. This method
|
|
986
|
+
* automatically associates this logged event with this Firebase web
|
|
987
|
+
* app instance on this device.
|
|
988
|
+
* @public
|
|
989
|
+
* List of recommended event parameters can be found in
|
|
990
|
+
* {@link https://developers.google.com/gtagjs/reference/ga4-events
|
|
991
|
+
* | the GA4 reference documentation}.
|
|
992
|
+
*/
|
|
993
|
+
declare function logEvent(analyticsInstance: Analytics, eventName: 'view_cart' | 'view_item', eventParams?: {
|
|
994
|
+
currency?: EventParams['currency'];
|
|
995
|
+
items?: EventParams['items'];
|
|
996
|
+
value?: EventParams['value'];
|
|
997
|
+
[key: string]: any;
|
|
998
|
+
}, options?: AnalyticsCallOptions): void;
|
|
999
|
+
/**
|
|
1000
|
+
* Sends a Google Analytics event with given `eventParams`. This method
|
|
1001
|
+
* automatically associates this logged event with this Firebase web
|
|
1002
|
+
* app instance on this device.
|
|
1003
|
+
* @public
|
|
1004
|
+
* List of recommended event parameters can be found in
|
|
1005
|
+
* {@link https://developers.google.com/gtagjs/reference/ga4-events
|
|
1006
|
+
* | the GA4 reference documentation}.
|
|
1007
|
+
*/
|
|
1008
|
+
declare function logEvent(analyticsInstance: Analytics, eventName: 'view_item_list', eventParams?: {
|
|
1009
|
+
items?: EventParams['items'];
|
|
1010
|
+
item_list_name?: EventParams['item_list_name'];
|
|
1011
|
+
item_list_id?: EventParams['item_list_id'];
|
|
1012
|
+
[key: string]: any;
|
|
1013
|
+
}, options?: AnalyticsCallOptions): void;
|
|
1014
|
+
/**
|
|
1015
|
+
* Sends a Google Analytics event with given `eventParams`. This method
|
|
1016
|
+
* automatically associates this logged event with this Firebase web
|
|
1017
|
+
* app instance on this device.
|
|
1018
|
+
* @public
|
|
1019
|
+
* List of recommended event parameters can be found in
|
|
1020
|
+
* {@link https://developers.google.com/gtagjs/reference/ga4-events
|
|
1021
|
+
* | the GA4 reference documentation}.
|
|
1022
|
+
*/
|
|
1023
|
+
declare function logEvent<T extends string>(analyticsInstance: Analytics, eventName: CustomEventName<T>, eventParams?: {
|
|
1024
|
+
[key: string]: any;
|
|
1025
|
+
}, options?: AnalyticsCallOptions): void;
|
|
1026
|
+
/**
|
|
1027
|
+
* Any custom event name string not in the standard list of recommended
|
|
1028
|
+
* event names.
|
|
1029
|
+
* @public
|
|
1030
|
+
*/
|
|
1031
|
+
type CustomEventName<T> = T extends EventNameString ? never : T;
|
|
1032
|
+
/**
|
|
1033
|
+
* Sets the applicable end user consent state for this web app across all gtag references once
|
|
1034
|
+
* Firebase Analytics is initialized.
|
|
1035
|
+
*
|
|
1036
|
+
* Use the {@link ConsentSettings} to specify individual consent type values. By default consent
|
|
1037
|
+
* types are set to "granted".
|
|
1038
|
+
* @public
|
|
1039
|
+
* @param consentSettings - Maps the applicable end user consent state for gtag.js.
|
|
1040
|
+
*/
|
|
1041
|
+
declare function setConsent(consentSettings: ConsentSettings): void;
|
|
1042
|
+
|
|
1043
|
+
/**
|
|
1044
|
+
* The Firebase Analytics Web SDK.
|
|
1045
|
+
* This SDK does not work in a Node.js environment.
|
|
1046
|
+
*
|
|
1047
|
+
* @packageDocumentation
|
|
1048
|
+
*/
|
|
1049
|
+
|
|
1050
|
+
declare global {
|
|
1051
|
+
interface Window {
|
|
1052
|
+
[key: string]: unknown;
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
export { Analytics, AnalyticsCallOptions, AnalyticsSettings, ConsentSettings, ConsentStatusString, ControlParams, Currency, CustomEventName, CustomParams, EventNameString, EventParams, GtagConfigParams, Item, Promotion, SettingsOptions, getAnalytics, getGoogleAnalyticsClientId, initializeAnalytics, isSupported, logEvent, setAnalyticsCollectionEnabled, setConsent, setCurrentScreen, setDefaultEventParameters, setUserId, setUserProperties, settings };
|