@firebase/analytics 0.10.9 → 0.10.10
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/dist/esm/index.esm2017.js +1241 -1241
- package/dist/esm/index.esm2017.js.map +1 -1
- package/dist/esm/src/api.d.ts +453 -453
- package/dist/esm/src/api.test.d.ts +17 -17
- package/dist/esm/src/constants.d.ts +32 -32
- package/dist/esm/src/errors.d.ts +57 -57
- package/dist/esm/src/factory.d.ts +74 -74
- package/dist/esm/src/functions.d.ts +85 -85
- package/dist/esm/src/functions.test.d.ts +17 -17
- package/dist/esm/src/get-config.d.ts +72 -72
- package/dist/esm/src/get-config.test.d.ts +17 -17
- package/dist/esm/src/helpers.d.ts +70 -71
- package/dist/esm/src/helpers.test.d.ts +17 -17
- package/dist/esm/src/index.d.ts +14 -14
- package/dist/esm/src/index.test.d.ts +17 -17
- package/dist/esm/src/initialize-analytics.d.ts +36 -36
- package/dist/esm/src/initialize-analytics.test.d.ts +17 -17
- package/dist/esm/src/logger.d.ts +18 -18
- package/dist/esm/src/public-types.d.ts +282 -282
- package/dist/esm/src/types.d.ts +55 -55
- package/dist/esm/testing/get-fake-firebase-services.d.ts +29 -29
- package/dist/esm/testing/gtag-script-util.d.ts +1 -1
- package/dist/esm/testing/integration-tests/integration.d.ts +18 -18
- package/dist/esm/testing/setup.d.ts +17 -17
- package/dist/index.cjs.js +1241 -1241
- package/dist/index.cjs.js.map +1 -1
- package/dist/src/api.d.ts +453 -453
- package/dist/src/api.test.d.ts +17 -17
- package/dist/src/constants.d.ts +32 -32
- package/dist/src/errors.d.ts +57 -57
- package/dist/src/factory.d.ts +74 -74
- package/dist/src/functions.d.ts +85 -85
- package/dist/src/functions.test.d.ts +17 -17
- package/dist/src/get-config.d.ts +72 -72
- package/dist/src/get-config.test.d.ts +17 -17
- package/dist/src/helpers.d.ts +70 -71
- package/dist/src/helpers.test.d.ts +17 -17
- package/dist/src/index.d.ts +14 -14
- package/dist/src/index.test.d.ts +17 -17
- package/dist/src/initialize-analytics.d.ts +36 -36
- package/dist/src/initialize-analytics.test.d.ts +17 -17
- package/dist/src/logger.d.ts +18 -18
- package/dist/src/public-types.d.ts +282 -282
- package/dist/src/types.d.ts +55 -55
- package/dist/testing/get-fake-firebase-services.d.ts +29 -29
- package/dist/testing/gtag-script-util.d.ts +1 -1
- package/dist/testing/integration-tests/integration.d.ts +18 -18
- package/dist/testing/setup.d.ts +17 -17
- package/package.json +7 -7
|
@@ -1,282 +1,282 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2019 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
|
-
import { FirebaseApp } from '@firebase/app';
|
|
18
|
-
/**
|
|
19
|
-
* A set of common Google Analytics config settings recognized by
|
|
20
|
-
* `gtag.js`.
|
|
21
|
-
* @public
|
|
22
|
-
*/
|
|
23
|
-
export interface GtagConfigParams {
|
|
24
|
-
/**
|
|
25
|
-
* Whether or not a page view should be sent.
|
|
26
|
-
* If set to true (default), a page view is automatically sent upon initialization
|
|
27
|
-
* of analytics.
|
|
28
|
-
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views }
|
|
29
|
-
*/
|
|
30
|
-
'send_page_view'?: boolean;
|
|
31
|
-
/**
|
|
32
|
-
* The title of the page.
|
|
33
|
-
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views }
|
|
34
|
-
*/
|
|
35
|
-
'page_title'?: string;
|
|
36
|
-
/**
|
|
37
|
-
* The URL of the page.
|
|
38
|
-
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views }
|
|
39
|
-
*/
|
|
40
|
-
'page_location'?: string;
|
|
41
|
-
/**
|
|
42
|
-
* Defaults to `auto`.
|
|
43
|
-
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
|
|
44
|
-
*/
|
|
45
|
-
'cookie_domain'?: string;
|
|
46
|
-
/**
|
|
47
|
-
* Defaults to 63072000 (two years, in seconds).
|
|
48
|
-
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
|
|
49
|
-
*/
|
|
50
|
-
'cookie_expires'?: number;
|
|
51
|
-
/**
|
|
52
|
-
* Defaults to `_ga`.
|
|
53
|
-
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
|
|
54
|
-
*/
|
|
55
|
-
'cookie_prefix'?: string;
|
|
56
|
-
/**
|
|
57
|
-
* If set to true, will update cookies on each page load.
|
|
58
|
-
* Defaults to true.
|
|
59
|
-
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
|
|
60
|
-
*/
|
|
61
|
-
'cookie_update'?: boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Appends additional flags to the cookie when set.
|
|
64
|
-
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
|
|
65
|
-
*/
|
|
66
|
-
'cookie_flags'?: string;
|
|
67
|
-
/**
|
|
68
|
-
* If set to false, disables all advertising features with `gtag.js`.
|
|
69
|
-
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features }
|
|
70
|
-
*/
|
|
71
|
-
'allow_google_signals'?: boolean;
|
|
72
|
-
/**
|
|
73
|
-
* If set to false, disables all advertising personalization with `gtag.js`.
|
|
74
|
-
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features }
|
|
75
|
-
*/
|
|
76
|
-
'allow_ad_personalization_signals'?: boolean;
|
|
77
|
-
[key: string]: unknown;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* {@link Analytics} instance initialization options.
|
|
81
|
-
* @public
|
|
82
|
-
*/
|
|
83
|
-
export interface AnalyticsSettings {
|
|
84
|
-
/**
|
|
85
|
-
* Params to be passed in the initial `gtag` config call during Firebase
|
|
86
|
-
* Analytics initialization.
|
|
87
|
-
*/
|
|
88
|
-
config?: GtagConfigParams | EventParams;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Additional options that can be passed to Analytics method
|
|
92
|
-
* calls such as `logEvent`, etc.
|
|
93
|
-
* @public
|
|
94
|
-
*/
|
|
95
|
-
export interface AnalyticsCallOptions {
|
|
96
|
-
/**
|
|
97
|
-
* If true, this config or event call applies globally to all
|
|
98
|
-
* Google Analytics properties on the page.
|
|
99
|
-
*/
|
|
100
|
-
global: boolean;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* An instance of Firebase Analytics.
|
|
104
|
-
* @public
|
|
105
|
-
*/
|
|
106
|
-
export interface Analytics {
|
|
107
|
-
/**
|
|
108
|
-
* The {@link @firebase/app#FirebaseApp} this {@link Analytics} instance is associated with.
|
|
109
|
-
*/
|
|
110
|
-
app: FirebaseApp;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Specifies custom options for your Firebase Analytics instance.
|
|
114
|
-
* You must set these before initializing `firebase.analytics()`.
|
|
115
|
-
* @public
|
|
116
|
-
*/
|
|
117
|
-
export interface SettingsOptions {
|
|
118
|
-
/** Sets custom name for `gtag` function. */
|
|
119
|
-
gtagName?: string;
|
|
120
|
-
/** Sets custom name for `dataLayer` array used by `gtag.js`. */
|
|
121
|
-
dataLayerName?: string;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Any custom params the user may pass to `gtag`.
|
|
125
|
-
* @public
|
|
126
|
-
*/
|
|
127
|
-
export interface CustomParams {
|
|
128
|
-
[key: string]: unknown;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Type for standard Google Analytics event names. `logEvent` also accepts any
|
|
132
|
-
* custom string and interprets it as a custom event name.
|
|
133
|
-
* @public
|
|
134
|
-
*/
|
|
135
|
-
export
|
|
136
|
-
/**
|
|
137
|
-
* Standard Google Analytics currency type.
|
|
138
|
-
* @public
|
|
139
|
-
*/
|
|
140
|
-
export
|
|
141
|
-
/**
|
|
142
|
-
* Standard Google Analytics `Item` type.
|
|
143
|
-
* @public
|
|
144
|
-
*/
|
|
145
|
-
export interface Item {
|
|
146
|
-
item_id?: string;
|
|
147
|
-
item_name?: string;
|
|
148
|
-
item_brand?: string;
|
|
149
|
-
item_category?: string;
|
|
150
|
-
item_category2?: string;
|
|
151
|
-
item_category3?: string;
|
|
152
|
-
item_category4?: string;
|
|
153
|
-
item_category5?: string;
|
|
154
|
-
item_variant?: string;
|
|
155
|
-
price?: Currency;
|
|
156
|
-
quantity?: number;
|
|
157
|
-
index?: number;
|
|
158
|
-
coupon?: string;
|
|
159
|
-
item_list_name?: string;
|
|
160
|
-
item_list_id?: string;
|
|
161
|
-
discount?: Currency;
|
|
162
|
-
affiliation?: string;
|
|
163
|
-
creative_name?: string;
|
|
164
|
-
creative_slot?: string;
|
|
165
|
-
promotion_id?: string;
|
|
166
|
-
promotion_name?: string;
|
|
167
|
-
location_id?: string;
|
|
168
|
-
/** @deprecated Use item_brand instead. */
|
|
169
|
-
brand?: string;
|
|
170
|
-
/** @deprecated Use item_category instead. */
|
|
171
|
-
category?: string;
|
|
172
|
-
/** @deprecated Use item_id instead. */
|
|
173
|
-
id?: string;
|
|
174
|
-
/** @deprecated Use item_name instead. */
|
|
175
|
-
name?: string;
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Field previously used by some Google Analytics events.
|
|
179
|
-
* @deprecated Use `Item` instead.
|
|
180
|
-
* @public
|
|
181
|
-
*/
|
|
182
|
-
export interface Promotion {
|
|
183
|
-
creative_name?: string;
|
|
184
|
-
creative_slot?: string;
|
|
185
|
-
id?: string;
|
|
186
|
-
name?: string;
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Standard `gtag.js` control parameters.
|
|
190
|
-
* For more information, see
|
|
191
|
-
* {@link https://developers.google.com/gtagjs/reference/ga4-events
|
|
192
|
-
* | the GA4 reference documentation}.
|
|
193
|
-
* @public
|
|
194
|
-
*/
|
|
195
|
-
export interface ControlParams {
|
|
196
|
-
groups?: string | string[];
|
|
197
|
-
send_to?: string | string[];
|
|
198
|
-
event_callback?: () => void;
|
|
199
|
-
event_timeout?: number;
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Standard `gtag.js` event parameters.
|
|
203
|
-
* For more information, see
|
|
204
|
-
* {@link https://developers.google.com/gtagjs/reference/ga4-events
|
|
205
|
-
* | the GA4 reference documentation}.
|
|
206
|
-
* @public
|
|
207
|
-
*/
|
|
208
|
-
export interface EventParams {
|
|
209
|
-
checkout_option?: string;
|
|
210
|
-
checkout_step?: number;
|
|
211
|
-
item_id?: string;
|
|
212
|
-
content_type?: string;
|
|
213
|
-
coupon?: string;
|
|
214
|
-
currency?: string;
|
|
215
|
-
description?: string;
|
|
216
|
-
fatal?: boolean;
|
|
217
|
-
items?: Item[];
|
|
218
|
-
method?: string;
|
|
219
|
-
number?: string;
|
|
220
|
-
promotions?: Promotion[];
|
|
221
|
-
screen_name?: string;
|
|
222
|
-
/**
|
|
223
|
-
* Firebase-specific. Use to log a `screen_name` to Firebase Analytics.
|
|
224
|
-
*/
|
|
225
|
-
firebase_screen?: string;
|
|
226
|
-
/**
|
|
227
|
-
* Firebase-specific. Use to log a `screen_class` to Firebase Analytics.
|
|
228
|
-
*/
|
|
229
|
-
firebase_screen_class?: string;
|
|
230
|
-
search_term?: string;
|
|
231
|
-
shipping?: Currency;
|
|
232
|
-
tax?: Currency;
|
|
233
|
-
transaction_id?: string;
|
|
234
|
-
value?: number;
|
|
235
|
-
event_label?: string;
|
|
236
|
-
event_category?: string;
|
|
237
|
-
shipping_tier?: string;
|
|
238
|
-
item_list_id?: string;
|
|
239
|
-
item_list_name?: string;
|
|
240
|
-
promotion_id?: string;
|
|
241
|
-
promotion_name?: string;
|
|
242
|
-
payment_type?: string;
|
|
243
|
-
affiliation?: string;
|
|
244
|
-
page_title?: string;
|
|
245
|
-
page_location?: string;
|
|
246
|
-
page_path?: string;
|
|
247
|
-
[key: string]: unknown;
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Consent status settings for each consent type.
|
|
251
|
-
* For more information, see
|
|
252
|
-
* {@link https://developers.google.com/tag-platform/tag-manager/templates/consent-apis
|
|
253
|
-
* | the GA4 reference documentation for consent state and consent types}.
|
|
254
|
-
* @public
|
|
255
|
-
*/
|
|
256
|
-
export interface ConsentSettings {
|
|
257
|
-
/** Enables storage, such as cookies, related to advertising */
|
|
258
|
-
ad_storage?: ConsentStatusString;
|
|
259
|
-
/** Sets consent for sending user data to Google for advertising purposes. */
|
|
260
|
-
ad_user_data?: ConsentStatusString;
|
|
261
|
-
/** Sets consent for personalized advertising. */
|
|
262
|
-
ad_personalization?: ConsentStatusString;
|
|
263
|
-
/** Enables storage, such as cookies, related to analytics (for example, visit duration) */
|
|
264
|
-
analytics_storage?: ConsentStatusString;
|
|
265
|
-
/**
|
|
266
|
-
* Enables storage that supports the functionality of the website or app such as language settings
|
|
267
|
-
*/
|
|
268
|
-
functionality_storage?: ConsentStatusString;
|
|
269
|
-
/** Enables storage related to personalization such as video recommendations */
|
|
270
|
-
personalization_storage?: ConsentStatusString;
|
|
271
|
-
/**
|
|
272
|
-
* Enables storage related to security such as authentication functionality, fraud prevention,
|
|
273
|
-
* and other user protection.
|
|
274
|
-
*/
|
|
275
|
-
security_storage?: ConsentStatusString;
|
|
276
|
-
[key: string]: unknown;
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* Whether a particular consent type has been granted or denied.
|
|
280
|
-
* @public
|
|
281
|
-
*/
|
|
282
|
-
export
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2019 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
|
+
import { FirebaseApp } from '@firebase/app';
|
|
18
|
+
/**
|
|
19
|
+
* A set of common Google Analytics config settings recognized by
|
|
20
|
+
* `gtag.js`.
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export interface GtagConfigParams {
|
|
24
|
+
/**
|
|
25
|
+
* Whether or not a page view should be sent.
|
|
26
|
+
* If set to true (default), a page view is automatically sent upon initialization
|
|
27
|
+
* of analytics.
|
|
28
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views }
|
|
29
|
+
*/
|
|
30
|
+
'send_page_view'?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* The title of the page.
|
|
33
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views }
|
|
34
|
+
*/
|
|
35
|
+
'page_title'?: string;
|
|
36
|
+
/**
|
|
37
|
+
* The URL of the page.
|
|
38
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/views | Page views }
|
|
39
|
+
*/
|
|
40
|
+
'page_location'?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Defaults to `auto`.
|
|
43
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
|
|
44
|
+
*/
|
|
45
|
+
'cookie_domain'?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Defaults to 63072000 (two years, in seconds).
|
|
48
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
|
|
49
|
+
*/
|
|
50
|
+
'cookie_expires'?: number;
|
|
51
|
+
/**
|
|
52
|
+
* Defaults to `_ga`.
|
|
53
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
|
|
54
|
+
*/
|
|
55
|
+
'cookie_prefix'?: string;
|
|
56
|
+
/**
|
|
57
|
+
* If set to true, will update cookies on each page load.
|
|
58
|
+
* Defaults to true.
|
|
59
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
|
|
60
|
+
*/
|
|
61
|
+
'cookie_update'?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Appends additional flags to the cookie when set.
|
|
64
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
|
|
65
|
+
*/
|
|
66
|
+
'cookie_flags'?: string;
|
|
67
|
+
/**
|
|
68
|
+
* If set to false, disables all advertising features with `gtag.js`.
|
|
69
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features }
|
|
70
|
+
*/
|
|
71
|
+
'allow_google_signals'?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* If set to false, disables all advertising personalization with `gtag.js`.
|
|
74
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features }
|
|
75
|
+
*/
|
|
76
|
+
'allow_ad_personalization_signals'?: boolean;
|
|
77
|
+
[key: string]: unknown;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* {@link Analytics} instance initialization options.
|
|
81
|
+
* @public
|
|
82
|
+
*/
|
|
83
|
+
export interface AnalyticsSettings {
|
|
84
|
+
/**
|
|
85
|
+
* Params to be passed in the initial `gtag` config call during Firebase
|
|
86
|
+
* Analytics initialization.
|
|
87
|
+
*/
|
|
88
|
+
config?: GtagConfigParams | EventParams;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Additional options that can be passed to Analytics method
|
|
92
|
+
* calls such as `logEvent`, etc.
|
|
93
|
+
* @public
|
|
94
|
+
*/
|
|
95
|
+
export interface AnalyticsCallOptions {
|
|
96
|
+
/**
|
|
97
|
+
* If true, this config or event call applies globally to all
|
|
98
|
+
* Google Analytics properties on the page.
|
|
99
|
+
*/
|
|
100
|
+
global: boolean;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* An instance of Firebase Analytics.
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
106
|
+
export interface Analytics {
|
|
107
|
+
/**
|
|
108
|
+
* The {@link @firebase/app#FirebaseApp} this {@link Analytics} instance is associated with.
|
|
109
|
+
*/
|
|
110
|
+
app: FirebaseApp;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Specifies custom options for your Firebase Analytics instance.
|
|
114
|
+
* You must set these before initializing `firebase.analytics()`.
|
|
115
|
+
* @public
|
|
116
|
+
*/
|
|
117
|
+
export interface SettingsOptions {
|
|
118
|
+
/** Sets custom name for `gtag` function. */
|
|
119
|
+
gtagName?: string;
|
|
120
|
+
/** Sets custom name for `dataLayer` array used by `gtag.js`. */
|
|
121
|
+
dataLayerName?: string;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Any custom params the user may pass to `gtag`.
|
|
125
|
+
* @public
|
|
126
|
+
*/
|
|
127
|
+
export interface CustomParams {
|
|
128
|
+
[key: string]: unknown;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Type for standard Google Analytics event names. `logEvent` also accepts any
|
|
132
|
+
* custom string and interprets it as a custom event name.
|
|
133
|
+
* @public
|
|
134
|
+
*/
|
|
135
|
+
export 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';
|
|
136
|
+
/**
|
|
137
|
+
* Standard Google Analytics currency type.
|
|
138
|
+
* @public
|
|
139
|
+
*/
|
|
140
|
+
export type Currency = string | number;
|
|
141
|
+
/**
|
|
142
|
+
* Standard Google Analytics `Item` type.
|
|
143
|
+
* @public
|
|
144
|
+
*/
|
|
145
|
+
export interface Item {
|
|
146
|
+
item_id?: string;
|
|
147
|
+
item_name?: string;
|
|
148
|
+
item_brand?: string;
|
|
149
|
+
item_category?: string;
|
|
150
|
+
item_category2?: string;
|
|
151
|
+
item_category3?: string;
|
|
152
|
+
item_category4?: string;
|
|
153
|
+
item_category5?: string;
|
|
154
|
+
item_variant?: string;
|
|
155
|
+
price?: Currency;
|
|
156
|
+
quantity?: number;
|
|
157
|
+
index?: number;
|
|
158
|
+
coupon?: string;
|
|
159
|
+
item_list_name?: string;
|
|
160
|
+
item_list_id?: string;
|
|
161
|
+
discount?: Currency;
|
|
162
|
+
affiliation?: string;
|
|
163
|
+
creative_name?: string;
|
|
164
|
+
creative_slot?: string;
|
|
165
|
+
promotion_id?: string;
|
|
166
|
+
promotion_name?: string;
|
|
167
|
+
location_id?: string;
|
|
168
|
+
/** @deprecated Use item_brand instead. */
|
|
169
|
+
brand?: string;
|
|
170
|
+
/** @deprecated Use item_category instead. */
|
|
171
|
+
category?: string;
|
|
172
|
+
/** @deprecated Use item_id instead. */
|
|
173
|
+
id?: string;
|
|
174
|
+
/** @deprecated Use item_name instead. */
|
|
175
|
+
name?: string;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Field previously used by some Google Analytics events.
|
|
179
|
+
* @deprecated Use `Item` instead.
|
|
180
|
+
* @public
|
|
181
|
+
*/
|
|
182
|
+
export interface Promotion {
|
|
183
|
+
creative_name?: string;
|
|
184
|
+
creative_slot?: string;
|
|
185
|
+
id?: string;
|
|
186
|
+
name?: string;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Standard `gtag.js` control parameters.
|
|
190
|
+
* For more information, see
|
|
191
|
+
* {@link https://developers.google.com/gtagjs/reference/ga4-events
|
|
192
|
+
* | the GA4 reference documentation}.
|
|
193
|
+
* @public
|
|
194
|
+
*/
|
|
195
|
+
export interface ControlParams {
|
|
196
|
+
groups?: string | string[];
|
|
197
|
+
send_to?: string | string[];
|
|
198
|
+
event_callback?: () => void;
|
|
199
|
+
event_timeout?: number;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Standard `gtag.js` event parameters.
|
|
203
|
+
* For more information, see
|
|
204
|
+
* {@link https://developers.google.com/gtagjs/reference/ga4-events
|
|
205
|
+
* | the GA4 reference documentation}.
|
|
206
|
+
* @public
|
|
207
|
+
*/
|
|
208
|
+
export interface EventParams {
|
|
209
|
+
checkout_option?: string;
|
|
210
|
+
checkout_step?: number;
|
|
211
|
+
item_id?: string;
|
|
212
|
+
content_type?: string;
|
|
213
|
+
coupon?: string;
|
|
214
|
+
currency?: string;
|
|
215
|
+
description?: string;
|
|
216
|
+
fatal?: boolean;
|
|
217
|
+
items?: Item[];
|
|
218
|
+
method?: string;
|
|
219
|
+
number?: string;
|
|
220
|
+
promotions?: Promotion[];
|
|
221
|
+
screen_name?: string;
|
|
222
|
+
/**
|
|
223
|
+
* Firebase-specific. Use to log a `screen_name` to Firebase Analytics.
|
|
224
|
+
*/
|
|
225
|
+
firebase_screen?: string;
|
|
226
|
+
/**
|
|
227
|
+
* Firebase-specific. Use to log a `screen_class` to Firebase Analytics.
|
|
228
|
+
*/
|
|
229
|
+
firebase_screen_class?: string;
|
|
230
|
+
search_term?: string;
|
|
231
|
+
shipping?: Currency;
|
|
232
|
+
tax?: Currency;
|
|
233
|
+
transaction_id?: string;
|
|
234
|
+
value?: number;
|
|
235
|
+
event_label?: string;
|
|
236
|
+
event_category?: string;
|
|
237
|
+
shipping_tier?: string;
|
|
238
|
+
item_list_id?: string;
|
|
239
|
+
item_list_name?: string;
|
|
240
|
+
promotion_id?: string;
|
|
241
|
+
promotion_name?: string;
|
|
242
|
+
payment_type?: string;
|
|
243
|
+
affiliation?: string;
|
|
244
|
+
page_title?: string;
|
|
245
|
+
page_location?: string;
|
|
246
|
+
page_path?: string;
|
|
247
|
+
[key: string]: unknown;
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Consent status settings for each consent type.
|
|
251
|
+
* For more information, see
|
|
252
|
+
* {@link https://developers.google.com/tag-platform/tag-manager/templates/consent-apis
|
|
253
|
+
* | the GA4 reference documentation for consent state and consent types}.
|
|
254
|
+
* @public
|
|
255
|
+
*/
|
|
256
|
+
export interface ConsentSettings {
|
|
257
|
+
/** Enables storage, such as cookies, related to advertising */
|
|
258
|
+
ad_storage?: ConsentStatusString;
|
|
259
|
+
/** Sets consent for sending user data to Google for advertising purposes. */
|
|
260
|
+
ad_user_data?: ConsentStatusString;
|
|
261
|
+
/** Sets consent for personalized advertising. */
|
|
262
|
+
ad_personalization?: ConsentStatusString;
|
|
263
|
+
/** Enables storage, such as cookies, related to analytics (for example, visit duration) */
|
|
264
|
+
analytics_storage?: ConsentStatusString;
|
|
265
|
+
/**
|
|
266
|
+
* Enables storage that supports the functionality of the website or app such as language settings
|
|
267
|
+
*/
|
|
268
|
+
functionality_storage?: ConsentStatusString;
|
|
269
|
+
/** Enables storage related to personalization such as video recommendations */
|
|
270
|
+
personalization_storage?: ConsentStatusString;
|
|
271
|
+
/**
|
|
272
|
+
* Enables storage related to security such as authentication functionality, fraud prevention,
|
|
273
|
+
* and other user protection.
|
|
274
|
+
*/
|
|
275
|
+
security_storage?: ConsentStatusString;
|
|
276
|
+
[key: string]: unknown;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Whether a particular consent type has been granted or denied.
|
|
280
|
+
* @public
|
|
281
|
+
*/
|
|
282
|
+
export type ConsentStatusString = 'granted' | 'denied';
|