@segment/analytics-browser-actions-google-analytics-4 1.0.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/package.json +20 -0
- package/src/__tests__/addPaymentInfo.test.ts +101 -0
- package/src/__tests__/addToCart.test.ts +95 -0
- package/src/__tests__/addToWishlist.test.ts +95 -0
- package/src/__tests__/beginCheckout.test.ts +101 -0
- package/src/__tests__/customEvent.test.ts +70 -0
- package/src/__tests__/generateLead.test.ts +68 -0
- package/src/__tests__/login.test.ts +63 -0
- package/src/__tests__/purchase.test.ts +103 -0
- package/src/__tests__/refund.test.ts +103 -0
- package/src/__tests__/removeFromCart.test.ts +99 -0
- package/src/__tests__/search.test.ts +64 -0
- package/src/__tests__/selectItem.test.ts +96 -0
- package/src/__tests__/selectPromotion.test.ts +111 -0
- package/src/__tests__/signUp.test.ts +62 -0
- package/src/__tests__/viewCart.test.ts +96 -0
- package/src/__tests__/viewItem.test.ts +96 -0
- package/src/__tests__/viewItemList.test.ts +96 -0
- package/src/__tests__/viewPromotion.test.ts +111 -0
- package/src/addPaymentInfo/generated-types.ts +117 -0
- package/src/addPaymentInfo/index.ts +48 -0
- package/src/addToCart/generated-types.ts +109 -0
- package/src/addToCart/index.ts +36 -0
- package/src/addToWishlist/generated-types.ts +109 -0
- package/src/addToWishlist/index.ts +38 -0
- package/src/beginCheckout/generated-types.ts +113 -0
- package/src/beginCheckout/index.ts +38 -0
- package/src/customEvent/generated-types.ts +28 -0
- package/src/customEvent/index.ts +52 -0
- package/src/ga4-functions.ts +8 -0
- package/src/ga4-properties.ts +368 -0
- package/src/ga4-types.ts +28 -0
- package/src/generateLead/generated-types.ts +28 -0
- package/src/generateLead/index.ts +32 -0
- package/src/generated-types.ts +56 -0
- package/src/index.ts +194 -0
- package/src/login/generated-types.ts +24 -0
- package/src/login/index.ts +31 -0
- package/src/purchase/generated-types.ts +125 -0
- package/src/purchase/index.ts +54 -0
- package/src/refund/generated-types.ts +129 -0
- package/src/refund/index.ts +57 -0
- package/src/removeFromCart/generated-types.ts +109 -0
- package/src/removeFromCart/index.ts +37 -0
- package/src/search/generated-types.ts +24 -0
- package/src/search/index.ts +30 -0
- package/src/selectItem/generated-types.ts +109 -0
- package/src/selectItem/index.ts +43 -0
- package/src/selectPromotion/generated-types.ts +137 -0
- package/src/selectPromotion/index.ts +67 -0
- package/src/setConfigurationFields/generated-types.ts +70 -0
- package/src/setConfigurationFields/index.ts +143 -0
- package/src/signUp/generated-types.ts +24 -0
- package/src/signUp/index.ts +29 -0
- package/src/types.ts +3 -0
- package/src/viewCart/generated-types.ts +109 -0
- package/src/viewCart/index.ts +36 -0
- package/src/viewItem/generated-types.ts +109 -0
- package/src/viewItem/index.ts +37 -0
- package/src/viewItemList/generated-types.ts +109 -0
- package/src/viewItemList/index.ts +36 -0
- package/src/viewPromotion/generated-types.ts +137 -0
- package/src/viewPromotion/index.ts +67 -0
- package/tsconfig.json +9 -0
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
import { InputField } from '@segment/actions-core/destination-kit/types'
|
|
2
|
+
|
|
3
|
+
export const formatUserProperties = (userProperties: object | undefined): object | undefined => {
|
|
4
|
+
if (!userProperties) {
|
|
5
|
+
return undefined
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
let properties = {}
|
|
9
|
+
|
|
10
|
+
Object.entries(userProperties).forEach(([key, value]) => {
|
|
11
|
+
properties = { ...properties, ...{ [key]: { value: value } } }
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
return { user_properties: properties }
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const user_properties: InputField = {
|
|
18
|
+
label: 'User Properties',
|
|
19
|
+
description:
|
|
20
|
+
'The user properties to send to Google Analytics 4. You must create user-scoped dimensions to ensure custom properties are picked up by Google. See Google’s [Custom user properties](https://support.google.com/analytics/answer/9269570) to learn how to set and register user properties. ',
|
|
21
|
+
type: 'object',
|
|
22
|
+
additionalProperties: true,
|
|
23
|
+
defaultObjectUI: 'keyvalue'
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const params: InputField = {
|
|
27
|
+
label: 'Event Parameters',
|
|
28
|
+
description: 'The event parameters to send to Google Analytics 4.',
|
|
29
|
+
type: 'object',
|
|
30
|
+
additionalProperties: true,
|
|
31
|
+
defaultObjectUI: 'keyvalue'
|
|
32
|
+
}
|
|
33
|
+
export const user_id: InputField = {
|
|
34
|
+
label: 'User ID',
|
|
35
|
+
type: 'string',
|
|
36
|
+
description:
|
|
37
|
+
"A unique identifier for a user. See Google's [User-ID for cross-platform analysis](https://support.google.com/analytics/answer/9213390) and [Reporting: deduplicate user counts](https://support.google.com/analytics/answer/9355949?hl=en) documentation for more information on this identifier."
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const promotion_id: InputField = {
|
|
41
|
+
label: 'Promotion ID',
|
|
42
|
+
type: 'string',
|
|
43
|
+
description: 'The ID of the promotion associated with the event.'
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const promotion_name: InputField = {
|
|
47
|
+
label: 'Promotion Name',
|
|
48
|
+
type: 'string',
|
|
49
|
+
description: 'The name of the promotion associated with the event.'
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const creative_slot: InputField = {
|
|
53
|
+
label: 'Creative Slot',
|
|
54
|
+
type: 'string',
|
|
55
|
+
description: 'The name of the promotional creative slot associated with the event.'
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const creative_name: InputField = {
|
|
59
|
+
label: 'Creative Name',
|
|
60
|
+
type: 'string',
|
|
61
|
+
description: 'The name of the promotional creative.'
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const tax: InputField = {
|
|
65
|
+
label: 'Tax',
|
|
66
|
+
type: 'number',
|
|
67
|
+
description: 'Total tax associated with the transaction.',
|
|
68
|
+
default: {
|
|
69
|
+
'@path': '$.properties.tax'
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export const shipping: InputField = {
|
|
74
|
+
label: 'Shipping',
|
|
75
|
+
type: 'number',
|
|
76
|
+
description: 'Shipping cost associated with the transaction.',
|
|
77
|
+
default: {
|
|
78
|
+
'@path': '$.properties.shipping'
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export const transaction_id: InputField = {
|
|
83
|
+
label: 'Order Id',
|
|
84
|
+
type: 'string',
|
|
85
|
+
description: 'The unique identifier of a transaction.',
|
|
86
|
+
default: {
|
|
87
|
+
'@path': '$.properties.order_id'
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export const affiliation: InputField = {
|
|
92
|
+
label: 'Affiliation',
|
|
93
|
+
type: 'string',
|
|
94
|
+
description: 'Store or affiliation from which this transaction occurred (e.g. Google Store).',
|
|
95
|
+
default: {
|
|
96
|
+
'@path': '$.properties.affiliation'
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export const client_id: InputField = {
|
|
101
|
+
label: 'Client ID',
|
|
102
|
+
description: 'Uniquely identifies a user instance of a web client.',
|
|
103
|
+
type: 'string',
|
|
104
|
+
required: true,
|
|
105
|
+
default: {
|
|
106
|
+
'@if': {
|
|
107
|
+
exists: { '@path': '$.userId' },
|
|
108
|
+
then: { '@path': '$.userId' },
|
|
109
|
+
else: { '@path': '$.anonymousId' }
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export const currency: InputField = {
|
|
115
|
+
label: 'Currency',
|
|
116
|
+
type: 'string',
|
|
117
|
+
description: 'Currency of the items associated with the event, in 3-letter ISO 4217 format.',
|
|
118
|
+
default: { '@path': '$.properties.currency' }
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export const value: InputField = {
|
|
122
|
+
label: 'Value',
|
|
123
|
+
type: 'number',
|
|
124
|
+
description: 'The monetary value of the event.',
|
|
125
|
+
default: {
|
|
126
|
+
'@path': '$.properties.value'
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export const coupon: InputField = {
|
|
131
|
+
label: 'Coupon',
|
|
132
|
+
type: 'string',
|
|
133
|
+
description: 'Coupon code used for a purchase.'
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export const payment_type: InputField = {
|
|
137
|
+
label: 'Payment Type',
|
|
138
|
+
type: 'string',
|
|
139
|
+
description: 'The chosen method of payment.',
|
|
140
|
+
default: {
|
|
141
|
+
'@path': '$.properties.payment_method'
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export const method: InputField = {
|
|
146
|
+
label: 'Method',
|
|
147
|
+
type: 'string',
|
|
148
|
+
description: 'The method used to login.',
|
|
149
|
+
default: {
|
|
150
|
+
'@path': '$.properties.method'
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export const search_term: InputField = {
|
|
155
|
+
label: 'Search Term',
|
|
156
|
+
type: 'string',
|
|
157
|
+
description: 'The term that was searched for.',
|
|
158
|
+
default: {
|
|
159
|
+
'@path': `$.properties.query`
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export const item_list_name: InputField = {
|
|
164
|
+
label: 'Item List Name',
|
|
165
|
+
description: 'The name of the list in which the item was presented to the user.',
|
|
166
|
+
type: 'string',
|
|
167
|
+
default: {
|
|
168
|
+
'@path': `$.properties.item_list_name`
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
export const item_list_id: InputField = {
|
|
172
|
+
label: 'Item List Id',
|
|
173
|
+
description: 'The ID of the list in which the item was presented to the user.',
|
|
174
|
+
type: 'string',
|
|
175
|
+
default: {
|
|
176
|
+
'@path': `$.properties.item_list_id`
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
export const location_id: InputField = {
|
|
180
|
+
label: 'Location ID',
|
|
181
|
+
type: 'string',
|
|
182
|
+
description: 'The ID of the location.',
|
|
183
|
+
default: {
|
|
184
|
+
'@path': '$.properties.position'
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export const minimal_items: InputField = {
|
|
189
|
+
label: 'Products',
|
|
190
|
+
description: 'The list of products purchased.',
|
|
191
|
+
type: 'object',
|
|
192
|
+
multiple: true,
|
|
193
|
+
properties: {
|
|
194
|
+
item_id: {
|
|
195
|
+
label: 'Product ID',
|
|
196
|
+
type: 'string',
|
|
197
|
+
description: 'Identifier for the product being purchased.'
|
|
198
|
+
},
|
|
199
|
+
item_name: {
|
|
200
|
+
label: 'Name',
|
|
201
|
+
type: 'string',
|
|
202
|
+
description: 'Name of the product being purchased.'
|
|
203
|
+
},
|
|
204
|
+
affiliation: {
|
|
205
|
+
label: 'Affiliation',
|
|
206
|
+
type: 'string',
|
|
207
|
+
description: 'A product affiliation to designate a supplying company or brick and mortar store location.'
|
|
208
|
+
},
|
|
209
|
+
coupon: {
|
|
210
|
+
label: 'Coupon',
|
|
211
|
+
type: 'string',
|
|
212
|
+
description: 'Coupon code used for a purchase.'
|
|
213
|
+
},
|
|
214
|
+
currency: {
|
|
215
|
+
label: 'Currency',
|
|
216
|
+
type: 'string',
|
|
217
|
+
description: 'Currency of the purchase or items associated with the event, in 3-letter ISO 4217 format.'
|
|
218
|
+
},
|
|
219
|
+
discount: {
|
|
220
|
+
label: 'Discount',
|
|
221
|
+
type: 'number',
|
|
222
|
+
description: 'Monetary value of discount associated with a purchase.'
|
|
223
|
+
},
|
|
224
|
+
index: {
|
|
225
|
+
label: 'Index',
|
|
226
|
+
type: 'number',
|
|
227
|
+
description: 'The index/position of the item in a list.'
|
|
228
|
+
},
|
|
229
|
+
item_brand: {
|
|
230
|
+
label: 'Brand',
|
|
231
|
+
type: 'string',
|
|
232
|
+
description: 'Brand associated with the product.'
|
|
233
|
+
},
|
|
234
|
+
item_category: {
|
|
235
|
+
label: 'Category',
|
|
236
|
+
type: 'string',
|
|
237
|
+
description: 'Product category.'
|
|
238
|
+
},
|
|
239
|
+
item_category2: {
|
|
240
|
+
label: 'Category 2',
|
|
241
|
+
type: 'string',
|
|
242
|
+
description: 'Product category 2.'
|
|
243
|
+
},
|
|
244
|
+
item_category3: {
|
|
245
|
+
label: 'Category 3',
|
|
246
|
+
type: 'string',
|
|
247
|
+
description: 'Product category 3.'
|
|
248
|
+
},
|
|
249
|
+
item_category4: {
|
|
250
|
+
label: 'Category 4',
|
|
251
|
+
type: 'string',
|
|
252
|
+
description: 'Product category 4.'
|
|
253
|
+
},
|
|
254
|
+
item_category5: {
|
|
255
|
+
label: 'Category 5',
|
|
256
|
+
type: 'string',
|
|
257
|
+
description: 'Product category 5.'
|
|
258
|
+
},
|
|
259
|
+
item_list_id: {
|
|
260
|
+
label: 'Item List ID',
|
|
261
|
+
type: 'string',
|
|
262
|
+
description: 'The ID of the list in which the item was presented to the user.'
|
|
263
|
+
},
|
|
264
|
+
item_list_name: {
|
|
265
|
+
label: 'Item List Name',
|
|
266
|
+
type: 'string',
|
|
267
|
+
description: 'The name of the list in which the item was presented to the user.'
|
|
268
|
+
},
|
|
269
|
+
item_variant: {
|
|
270
|
+
label: 'Variant',
|
|
271
|
+
type: 'string',
|
|
272
|
+
description: 'Variant of the product (e.g. Black).'
|
|
273
|
+
},
|
|
274
|
+
location_id: {
|
|
275
|
+
label: 'Location ID',
|
|
276
|
+
type: 'string',
|
|
277
|
+
description: 'The location associated with the item.'
|
|
278
|
+
},
|
|
279
|
+
price: {
|
|
280
|
+
label: 'Price',
|
|
281
|
+
type: 'number',
|
|
282
|
+
description: 'Price of the product being purchased, in units of the specified currency parameter.'
|
|
283
|
+
},
|
|
284
|
+
quantity: {
|
|
285
|
+
label: 'Quantity',
|
|
286
|
+
type: 'integer',
|
|
287
|
+
description: 'Item quantity.'
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export const items_single_products: InputField = {
|
|
293
|
+
...minimal_items,
|
|
294
|
+
default: {
|
|
295
|
+
'@arrayPath': [
|
|
296
|
+
'$.properties.products',
|
|
297
|
+
{
|
|
298
|
+
item_id: {
|
|
299
|
+
'@path': '$.product_id'
|
|
300
|
+
},
|
|
301
|
+
item_name: {
|
|
302
|
+
'@path': '$.name'
|
|
303
|
+
},
|
|
304
|
+
affiliation: {
|
|
305
|
+
'@path': '$.affiliation'
|
|
306
|
+
},
|
|
307
|
+
coupon: {
|
|
308
|
+
'@path': '$.coupon'
|
|
309
|
+
},
|
|
310
|
+
item_brand: {
|
|
311
|
+
'@path': '$.brand'
|
|
312
|
+
},
|
|
313
|
+
item_category: {
|
|
314
|
+
'@path': '$.category'
|
|
315
|
+
},
|
|
316
|
+
item_variant: {
|
|
317
|
+
'@path': '$.variant'
|
|
318
|
+
},
|
|
319
|
+
price: {
|
|
320
|
+
'@path': '$.price'
|
|
321
|
+
},
|
|
322
|
+
quantity: {
|
|
323
|
+
'@path': '$.quantity'
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
]
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
export const items_multi_products: InputField = {
|
|
330
|
+
...minimal_items,
|
|
331
|
+
default: {
|
|
332
|
+
'@arrayPath': [
|
|
333
|
+
'$.properties.products',
|
|
334
|
+
{
|
|
335
|
+
item_id: {
|
|
336
|
+
'@path': '$.product_id'
|
|
337
|
+
},
|
|
338
|
+
item_name: {
|
|
339
|
+
'@path': '$.name'
|
|
340
|
+
},
|
|
341
|
+
affiliation: {
|
|
342
|
+
'@path': '$.affiliation'
|
|
343
|
+
},
|
|
344
|
+
coupon: {
|
|
345
|
+
'@path': '$.coupon'
|
|
346
|
+
},
|
|
347
|
+
index: {
|
|
348
|
+
'@path': '$.position'
|
|
349
|
+
},
|
|
350
|
+
item_brand: {
|
|
351
|
+
'@path': '$.brand'
|
|
352
|
+
},
|
|
353
|
+
item_category: {
|
|
354
|
+
'@path': '$.category'
|
|
355
|
+
},
|
|
356
|
+
item_variant: {
|
|
357
|
+
'@path': '$.variant'
|
|
358
|
+
},
|
|
359
|
+
price: {
|
|
360
|
+
'@path': '$.price'
|
|
361
|
+
},
|
|
362
|
+
quantity: {
|
|
363
|
+
'@path': '$.quantity'
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
]
|
|
367
|
+
}
|
|
368
|
+
}
|
package/src/ga4-types.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface ProductItem {
|
|
2
|
+
item_id?: string
|
|
3
|
+
item_name?: string
|
|
4
|
+
affiliation?: string
|
|
5
|
+
coupon?: string
|
|
6
|
+
currency?: string
|
|
7
|
+
discount?: number
|
|
8
|
+
index?: number
|
|
9
|
+
item_brand?: string
|
|
10
|
+
item_category?: string
|
|
11
|
+
item_category2?: string
|
|
12
|
+
item_category3?: string
|
|
13
|
+
item_category4?: string
|
|
14
|
+
item_category5?: string
|
|
15
|
+
item_list_id?: string
|
|
16
|
+
item_list_name?: string
|
|
17
|
+
item_variant?: string
|
|
18
|
+
location_id?: string
|
|
19
|
+
price?: number
|
|
20
|
+
quantity?: number
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface PromotionProductItem extends ProductItem {
|
|
24
|
+
creative_name?: string
|
|
25
|
+
creative_slot?: string
|
|
26
|
+
promotion_id?: string
|
|
27
|
+
promotion_name?: string
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Generated file. DO NOT MODIFY IT BY HAND.
|
|
2
|
+
|
|
3
|
+
export interface Payload {
|
|
4
|
+
/**
|
|
5
|
+
* A unique identifier for a user. See Google's [User-ID for cross-platform analysis](https://support.google.com/analytics/answer/9213390) and [Reporting: deduplicate user counts](https://support.google.com/analytics/answer/9355949?hl=en) documentation for more information on this identifier.
|
|
6
|
+
*/
|
|
7
|
+
user_id?: string
|
|
8
|
+
/**
|
|
9
|
+
* Currency of the items associated with the event, in 3-letter ISO 4217 format.
|
|
10
|
+
*/
|
|
11
|
+
currency?: string
|
|
12
|
+
/**
|
|
13
|
+
* The monetary value of the event.
|
|
14
|
+
*/
|
|
15
|
+
value?: number
|
|
16
|
+
/**
|
|
17
|
+
* The user properties to send to Google Analytics 4. You must create user-scoped dimensions to ensure custom properties are picked up by Google. See Google’s [Custom user properties](https://support.google.com/analytics/answer/9269570) to learn how to set and register user properties.
|
|
18
|
+
*/
|
|
19
|
+
user_properties?: {
|
|
20
|
+
[k: string]: unknown
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The event parameters to send to Google Analytics 4.
|
|
24
|
+
*/
|
|
25
|
+
params?: {
|
|
26
|
+
[k: string]: unknown
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { BrowserActionDefinition } from '@segment/browser-destination-runtime/types'
|
|
2
|
+
import type { Settings } from '../generated-types'
|
|
3
|
+
import type { Payload } from './generated-types'
|
|
4
|
+
|
|
5
|
+
import { user_properties, params, user_id, currency, value } from '../ga4-properties'
|
|
6
|
+
import { updateUser } from '../ga4-functions'
|
|
7
|
+
|
|
8
|
+
const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
9
|
+
title: 'Generate Lead',
|
|
10
|
+
description:
|
|
11
|
+
'Log this event when a lead has been generated to understand the efficacy of your re-engagement campaigns.',
|
|
12
|
+
platform: 'web',
|
|
13
|
+
defaultSubscription: 'type = "track"',
|
|
14
|
+
fields: {
|
|
15
|
+
user_id: user_id,
|
|
16
|
+
currency: currency,
|
|
17
|
+
value: value,
|
|
18
|
+
user_properties: user_properties,
|
|
19
|
+
params: params
|
|
20
|
+
},
|
|
21
|
+
perform: (gtag, { payload }) => {
|
|
22
|
+
updateUser(payload.user_id, payload.user_properties, gtag)
|
|
23
|
+
|
|
24
|
+
gtag('event', 'generate_lead', {
|
|
25
|
+
currency: payload.currency,
|
|
26
|
+
value: payload.value,
|
|
27
|
+
...payload.params
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default action
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Generated file. DO NOT MODIFY IT BY HAND.
|
|
2
|
+
|
|
3
|
+
export interface Settings {
|
|
4
|
+
/**
|
|
5
|
+
* The measurement ID associated with the web stream. Found in the Google Analytics UI under: Admin > Data Streams > Web > Measurement ID.
|
|
6
|
+
*/
|
|
7
|
+
measurementID: string
|
|
8
|
+
/**
|
|
9
|
+
* Set to false to disable all advertising features. Set to true by default.
|
|
10
|
+
*/
|
|
11
|
+
allowGoogleSignals?: boolean
|
|
12
|
+
/**
|
|
13
|
+
* Set to false to disable all advertising features. Set to true by default.
|
|
14
|
+
*/
|
|
15
|
+
allowAdPersonalizationSignals?: boolean
|
|
16
|
+
/**
|
|
17
|
+
* Specifies the domain used to store the analytics cookie. Set to “auto” by default.
|
|
18
|
+
*/
|
|
19
|
+
cookieDomain?: string
|
|
20
|
+
/**
|
|
21
|
+
* Every time a hit is sent to GA4, the analytics cookie expiration time is updated to be the current time plus the value of this field. The default value is two years (63072000 seconds). Please input the expiration value in seconds. More information in [Google Documentation](https://developers.google.com/analytics/devguides/collection/ga4/reference/config#)
|
|
22
|
+
*/
|
|
23
|
+
cookieExpirationInSeconds?: number
|
|
24
|
+
/**
|
|
25
|
+
* Appends additional flags to the analytics cookie. See [write a new cookie](https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie#write_a_new_cookie) for some examples of flags to set.
|
|
26
|
+
*/
|
|
27
|
+
cookieFlags?: string[]
|
|
28
|
+
/**
|
|
29
|
+
* Specifies the subpath used to store the analytics cookie.
|
|
30
|
+
*/
|
|
31
|
+
cookiePath?: string[]
|
|
32
|
+
/**
|
|
33
|
+
* Specifies a prefix to prepend to the analytics cookie name.
|
|
34
|
+
*/
|
|
35
|
+
cookiePrefix?: string[]
|
|
36
|
+
/**
|
|
37
|
+
* Set to false to not update cookies on each page load. This has the effect of cookie expiration being relative to the first time a user visited. Set to true by default so update cookies on each page load.
|
|
38
|
+
*/
|
|
39
|
+
cookieUpdate?: boolean
|
|
40
|
+
/**
|
|
41
|
+
* Set to true to enable Google’s [Consent Mode](https://support.google.com/analytics/answer/9976101?hl=en). Set to false by default.
|
|
42
|
+
*/
|
|
43
|
+
enableConsentMode?: boolean
|
|
44
|
+
/**
|
|
45
|
+
* The default value for ad cookies consent state. This is only used if Enable Consent Mode is on. Set to “granted” if it is not explicitly set. Consent state can be updated for each user in the Set Configuration Fields action.
|
|
46
|
+
*/
|
|
47
|
+
defaultAdsStorageConsentState?: string
|
|
48
|
+
/**
|
|
49
|
+
* The default value for analytics cookies consent state. This is only used if Enable Consent Mode is on. Set to “granted” if it is not explicitly set. Consent state can be updated for each user in the Set Configuration Fields action.
|
|
50
|
+
*/
|
|
51
|
+
defaultAnalyticsStorageConsentState?: string
|
|
52
|
+
/**
|
|
53
|
+
* If your CMP loads asynchronously, it might not always run before the Google tag. To handle such situations, specify a millisecond value to control how long to wait before the consent state update is sent. Please input the wait_for_update in milliseconds.
|
|
54
|
+
*/
|
|
55
|
+
waitTimeToUpdateConsentStage?: number
|
|
56
|
+
}
|