@segment/analytics-browser-actions-google-analytics-4 1.29.0 → 1.30.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/dist/cjs/addPaymentInfo/generated-types.d.ts +1 -0
- package/dist/cjs/addPaymentInfo/index.js +2 -2
- package/dist/cjs/addPaymentInfo/index.js.map +1 -1
- package/dist/cjs/addToCart/generated-types.d.ts +1 -0
- package/dist/cjs/addToCart/index.js +2 -2
- package/dist/cjs/addToCart/index.js.map +1 -1
- package/dist/cjs/addToWishlist/generated-types.d.ts +1 -0
- package/dist/cjs/addToWishlist/index.js +2 -2
- package/dist/cjs/addToWishlist/index.js.map +1 -1
- package/dist/cjs/beginCheckout/generated-types.d.ts +1 -0
- package/dist/cjs/beginCheckout/index.js +2 -2
- package/dist/cjs/beginCheckout/index.js.map +1 -1
- package/dist/cjs/customEvent/index.js +5 -3
- package/dist/cjs/customEvent/index.js.map +1 -1
- package/dist/cjs/ga4-properties.js +1 -0
- package/dist/cjs/ga4-properties.js.map +1 -1
- package/dist/cjs/generateLead/index.js +2 -2
- package/dist/cjs/generateLead/index.js.map +1 -1
- package/dist/cjs/login/index.js +2 -2
- package/dist/cjs/login/index.js.map +1 -1
- package/dist/cjs/purchase/generated-types.d.ts +1 -0
- package/dist/cjs/purchase/index.js +2 -2
- package/dist/cjs/purchase/index.js.map +1 -1
- package/dist/cjs/refund/generated-types.d.ts +1 -0
- package/dist/cjs/refund/index.js +2 -2
- package/dist/cjs/refund/index.js.map +1 -1
- package/dist/cjs/removeFromCart/generated-types.d.ts +1 -0
- package/dist/cjs/removeFromCart/index.js +2 -2
- package/dist/cjs/removeFromCart/index.js.map +1 -1
- package/dist/cjs/search/index.js +2 -2
- package/dist/cjs/search/index.js.map +1 -1
- package/dist/cjs/selectItem/generated-types.d.ts +1 -0
- package/dist/cjs/selectItem/index.js +2 -2
- package/dist/cjs/selectItem/index.js.map +1 -1
- package/dist/cjs/selectPromotion/generated-types.d.ts +1 -0
- package/dist/cjs/selectPromotion/index.js +2 -2
- package/dist/cjs/selectPromotion/index.js.map +1 -1
- package/dist/cjs/signUp/index.js +2 -2
- package/dist/cjs/signUp/index.js.map +1 -1
- package/dist/cjs/viewCart/generated-types.d.ts +1 -0
- package/dist/cjs/viewCart/index.js +2 -2
- package/dist/cjs/viewCart/index.js.map +1 -1
- package/dist/cjs/viewItem/generated-types.d.ts +1 -0
- package/dist/cjs/viewItem/index.js +2 -2
- package/dist/cjs/viewItem/index.js.map +1 -1
- package/dist/cjs/viewItemList/generated-types.d.ts +1 -0
- package/dist/cjs/viewItemList/index.js +2 -2
- package/dist/cjs/viewItemList/index.js.map +1 -1
- package/dist/cjs/viewPromotion/generated-types.d.ts +1 -0
- package/dist/cjs/viewPromotion/index.js +2 -2
- package/dist/cjs/viewPromotion/index.js.map +1 -1
- package/dist/esm/addPaymentInfo/generated-types.d.ts +1 -0
- package/dist/esm/addPaymentInfo/index.js +2 -2
- package/dist/esm/addPaymentInfo/index.js.map +1 -1
- package/dist/esm/addToCart/generated-types.d.ts +1 -0
- package/dist/esm/addToCart/index.js +2 -2
- package/dist/esm/addToCart/index.js.map +1 -1
- package/dist/esm/addToWishlist/generated-types.d.ts +1 -0
- package/dist/esm/addToWishlist/index.js +2 -2
- package/dist/esm/addToWishlist/index.js.map +1 -1
- package/dist/esm/beginCheckout/generated-types.d.ts +1 -0
- package/dist/esm/beginCheckout/index.js +2 -2
- package/dist/esm/beginCheckout/index.js.map +1 -1
- package/dist/esm/customEvent/index.js +5 -3
- package/dist/esm/customEvent/index.js.map +1 -1
- package/dist/esm/ga4-properties.js +1 -0
- package/dist/esm/ga4-properties.js.map +1 -1
- package/dist/esm/generateLead/index.js +2 -2
- package/dist/esm/generateLead/index.js.map +1 -1
- package/dist/esm/login/index.js +2 -2
- package/dist/esm/login/index.js.map +1 -1
- package/dist/esm/purchase/generated-types.d.ts +1 -0
- package/dist/esm/purchase/index.js +2 -2
- package/dist/esm/purchase/index.js.map +1 -1
- package/dist/esm/refund/generated-types.d.ts +1 -0
- package/dist/esm/refund/index.js +2 -2
- package/dist/esm/refund/index.js.map +1 -1
- package/dist/esm/removeFromCart/generated-types.d.ts +1 -0
- package/dist/esm/removeFromCart/index.js +2 -2
- package/dist/esm/removeFromCart/index.js.map +1 -1
- package/dist/esm/search/index.js +2 -2
- package/dist/esm/search/index.js.map +1 -1
- package/dist/esm/selectItem/generated-types.d.ts +1 -0
- package/dist/esm/selectItem/index.js +2 -2
- package/dist/esm/selectItem/index.js.map +1 -1
- package/dist/esm/selectPromotion/generated-types.d.ts +1 -0
- package/dist/esm/selectPromotion/index.js +2 -2
- package/dist/esm/selectPromotion/index.js.map +1 -1
- package/dist/esm/signUp/index.js +2 -2
- package/dist/esm/signUp/index.js.map +1 -1
- package/dist/esm/viewCart/generated-types.d.ts +1 -0
- package/dist/esm/viewCart/index.js +2 -2
- package/dist/esm/viewCart/index.js.map +1 -1
- package/dist/esm/viewItem/generated-types.d.ts +1 -0
- package/dist/esm/viewItem/index.js +2 -2
- package/dist/esm/viewItem/index.js.map +1 -1
- package/dist/esm/viewItemList/generated-types.d.ts +1 -0
- package/dist/esm/viewItemList/index.js +2 -2
- package/dist/esm/viewItemList/index.js.map +1 -1
- package/dist/esm/viewPromotion/generated-types.d.ts +1 -0
- package/dist/esm/viewPromotion/index.js +2 -2
- package/dist/esm/viewPromotion/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/addPaymentInfo/generated-types.ts +1 -0
- package/src/addPaymentInfo/index.ts +2 -2
- package/src/addToCart/generated-types.ts +1 -0
- package/src/addToCart/index.ts +2 -3
- package/src/addToWishlist/generated-types.ts +1 -0
- package/src/addToWishlist/index.ts +2 -3
- package/src/beginCheckout/generated-types.ts +1 -0
- package/src/beginCheckout/index.ts +2 -3
- package/src/customEvent/index.ts +5 -3
- package/src/ga4-properties.ts +1 -0
- package/src/generateLead/index.ts +2 -3
- package/src/login/index.ts +2 -3
- package/src/purchase/generated-types.ts +1 -0
- package/src/purchase/index.ts +2 -3
- package/src/refund/generated-types.ts +1 -0
- package/src/refund/index.ts +2 -3
- package/src/removeFromCart/generated-types.ts +1 -0
- package/src/removeFromCart/index.ts +2 -3
- package/src/search/index.ts +2 -3
- package/src/selectItem/generated-types.ts +1 -0
- package/src/selectItem/index.ts +2 -3
- package/src/selectPromotion/generated-types.ts +1 -0
- package/src/selectPromotion/index.ts +2 -4
- package/src/signUp/index.ts +2 -3
- package/src/viewCart/generated-types.ts +1 -0
- package/src/viewCart/index.ts +2 -3
- package/src/viewItem/generated-types.ts +1 -0
- package/src/viewItem/index.ts +2 -3
- package/src/viewItemList/generated-types.ts +1 -0
- package/src/viewItemList/index.ts +2 -3
- package/src/viewPromotion/generated-types.ts +1 -0
- package/src/viewPromotion/index.ts +2 -3
- package/dist/cjs/ga4-functions.d.ts +0 -1
- package/dist/cjs/ga4-functions.js +0 -13
- package/dist/cjs/ga4-functions.js.map +0 -1
- package/dist/esm/ga4-functions.d.ts +0 -1
- package/dist/esm/ga4-functions.js +0 -9
- package/dist/esm/ga4-functions.js.map +0 -1
- package/src/ga4-functions.ts +0 -8
|
@@ -3,7 +3,6 @@ import type { Settings } from '../generated-types'
|
|
|
3
3
|
import type { Payload } from './generated-types'
|
|
4
4
|
|
|
5
5
|
import { user_properties, params, value, currency, items_single_products, user_id } from '../ga4-properties'
|
|
6
|
-
import { updateUser } from '../ga4-functions'
|
|
7
6
|
|
|
8
7
|
// Change from unknown to the partner SDK types
|
|
9
8
|
const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
@@ -24,12 +23,12 @@ const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
|
24
23
|
params: params
|
|
25
24
|
},
|
|
26
25
|
perform: (gtag, { payload }) => {
|
|
27
|
-
updateUser(payload.user_id, payload.user_properties, gtag)
|
|
28
|
-
|
|
29
26
|
gtag('event', 'add_to_wishlist', {
|
|
30
27
|
currency: payload.currency,
|
|
31
28
|
value: payload.value,
|
|
32
29
|
items: payload.items,
|
|
30
|
+
user_id: payload.user_id ?? undefined,
|
|
31
|
+
user_properties: payload.user_properties,
|
|
33
32
|
...payload.params
|
|
34
33
|
})
|
|
35
34
|
}
|
|
@@ -3,7 +3,6 @@ import type { Settings } from '../generated-types'
|
|
|
3
3
|
import type { Payload } from './generated-types'
|
|
4
4
|
|
|
5
5
|
import { params, coupon, currency, value, items_multi_products, user_id, user_properties } from '../ga4-properties'
|
|
6
|
-
import { updateUser } from '../ga4-functions'
|
|
7
6
|
|
|
8
7
|
const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
9
8
|
title: 'Begin Checkout',
|
|
@@ -23,13 +22,13 @@ const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
|
23
22
|
user_properties: user_properties
|
|
24
23
|
},
|
|
25
24
|
perform: (gtag, { payload }) => {
|
|
26
|
-
updateUser(payload.user_id, payload.user_properties, gtag)
|
|
27
|
-
|
|
28
25
|
gtag('event', 'begin_checkout', {
|
|
29
26
|
currency: payload.currency,
|
|
30
27
|
value: payload.value,
|
|
31
28
|
coupon: payload.coupon,
|
|
32
29
|
items: payload.items,
|
|
30
|
+
user_id: payload.user_id ?? undefined,
|
|
31
|
+
user_properties: payload.user_properties,
|
|
33
32
|
...payload.params
|
|
34
33
|
})
|
|
35
34
|
}
|
package/src/customEvent/index.ts
CHANGED
|
@@ -2,7 +2,6 @@ import type { BrowserActionDefinition } from '@segment/browser-destination-runti
|
|
|
2
2
|
import type { Settings } from '../generated-types'
|
|
3
3
|
import type { Payload } from './generated-types'
|
|
4
4
|
import { user_id, user_properties, params } from '../ga4-properties'
|
|
5
|
-
import { updateUser } from '../ga4-functions'
|
|
6
5
|
|
|
7
6
|
const normalizeEventName = (name: string, lowercase: boolean | undefined): string => {
|
|
8
7
|
name = name.trim()
|
|
@@ -42,10 +41,13 @@ const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
|
42
41
|
params: params
|
|
43
42
|
},
|
|
44
43
|
perform: (gtag, { payload }) => {
|
|
45
|
-
updateUser(payload.user_id, payload.user_properties, gtag)
|
|
46
44
|
const event_name = normalizeEventName(payload.name, payload.lowercase)
|
|
47
45
|
|
|
48
|
-
gtag('event', event_name,
|
|
46
|
+
gtag('event', event_name, {
|
|
47
|
+
user_id: payload.user_id ?? undefined,
|
|
48
|
+
user_properties: payload.user_properties,
|
|
49
|
+
...payload.params
|
|
50
|
+
})
|
|
49
51
|
}
|
|
50
52
|
}
|
|
51
53
|
|
package/src/ga4-properties.ts
CHANGED
|
@@ -3,7 +3,6 @@ import type { Settings } from '../generated-types'
|
|
|
3
3
|
import type { Payload } from './generated-types'
|
|
4
4
|
|
|
5
5
|
import { user_properties, params, user_id, currency, value } from '../ga4-properties'
|
|
6
|
-
import { updateUser } from '../ga4-functions'
|
|
7
6
|
|
|
8
7
|
const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
9
8
|
title: 'Generate Lead',
|
|
@@ -19,11 +18,11 @@ const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
|
19
18
|
params: params
|
|
20
19
|
},
|
|
21
20
|
perform: (gtag, { payload }) => {
|
|
22
|
-
updateUser(payload.user_id, payload.user_properties, gtag)
|
|
23
|
-
|
|
24
21
|
gtag('event', 'generate_lead', {
|
|
25
22
|
currency: payload.currency,
|
|
26
23
|
value: payload.value,
|
|
24
|
+
user_id: payload.user_id ?? undefined,
|
|
25
|
+
user_properties: payload.user_properties,
|
|
27
26
|
...payload.params
|
|
28
27
|
})
|
|
29
28
|
}
|
package/src/login/index.ts
CHANGED
|
@@ -3,7 +3,6 @@ import type { Settings } from '../generated-types'
|
|
|
3
3
|
import type { Payload } from './generated-types'
|
|
4
4
|
|
|
5
5
|
import { user_properties, params, user_id, method } from '../ga4-properties'
|
|
6
|
-
import { updateUser } from '../ga4-functions'
|
|
7
6
|
|
|
8
7
|
// Change from unknown to the partner SDK types
|
|
9
8
|
const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
@@ -19,10 +18,10 @@ const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
|
19
18
|
},
|
|
20
19
|
|
|
21
20
|
perform: (gtag, { payload }) => {
|
|
22
|
-
updateUser(payload.user_id, payload.user_properties, gtag)
|
|
23
|
-
|
|
24
21
|
gtag('event', 'login', {
|
|
25
22
|
method: payload.method,
|
|
23
|
+
user_id: payload.user_id ?? undefined,
|
|
24
|
+
user_properties: payload.user_properties,
|
|
26
25
|
...payload.params
|
|
27
26
|
})
|
|
28
27
|
}
|
package/src/purchase/index.ts
CHANGED
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
params,
|
|
14
14
|
user_properties
|
|
15
15
|
} from '../ga4-properties'
|
|
16
|
-
import { updateUser } from '../ga4-functions'
|
|
17
16
|
|
|
18
17
|
const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
19
18
|
title: 'Purchase',
|
|
@@ -36,8 +35,6 @@ const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
|
36
35
|
params: params
|
|
37
36
|
},
|
|
38
37
|
perform: (gtag, { payload }) => {
|
|
39
|
-
updateUser(payload.user_id, payload.user_properties, gtag)
|
|
40
|
-
|
|
41
38
|
gtag('event', 'purchase', {
|
|
42
39
|
currency: payload.currency,
|
|
43
40
|
transaction_id: payload.transaction_id,
|
|
@@ -46,6 +43,8 @@ const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
|
46
43
|
tax: payload.tax,
|
|
47
44
|
shipping: payload.shipping,
|
|
48
45
|
items: payload.items,
|
|
46
|
+
user_id: payload.user_id ?? undefined,
|
|
47
|
+
user_properties: payload.user_properties,
|
|
49
48
|
...payload.params
|
|
50
49
|
})
|
|
51
50
|
}
|
|
@@ -113,6 +113,7 @@ export interface Payload {
|
|
|
113
113
|
* Item quantity.
|
|
114
114
|
*/
|
|
115
115
|
quantity?: number
|
|
116
|
+
[k: string]: unknown
|
|
116
117
|
}[]
|
|
117
118
|
/**
|
|
118
119
|
* 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.
|
package/src/refund/index.ts
CHANGED
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
user_properties,
|
|
16
16
|
tax
|
|
17
17
|
} from '../ga4-properties'
|
|
18
|
-
import { updateUser } from '../ga4-functions'
|
|
19
18
|
|
|
20
19
|
const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
21
20
|
title: 'Refund',
|
|
@@ -38,8 +37,6 @@ const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
|
38
37
|
params: params
|
|
39
38
|
},
|
|
40
39
|
perform: (gtag, { payload }) => {
|
|
41
|
-
updateUser(payload.user_id, payload.user_properties, gtag)
|
|
42
|
-
|
|
43
40
|
gtag('event', 'refund', {
|
|
44
41
|
currency: payload.currency,
|
|
45
42
|
transaction_id: payload.transaction_id, // Transaction ID. Required for purchases and refunds.
|
|
@@ -49,6 +46,8 @@ const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
|
49
46
|
shipping: payload.shipping,
|
|
50
47
|
tax: payload.tax,
|
|
51
48
|
items: payload.items,
|
|
49
|
+
user_id: payload.user_id ?? undefined,
|
|
50
|
+
user_properties: payload.user_properties,
|
|
52
51
|
...payload.params
|
|
53
52
|
})
|
|
54
53
|
}
|
|
@@ -93,6 +93,7 @@ export interface Payload {
|
|
|
93
93
|
* Item quantity.
|
|
94
94
|
*/
|
|
95
95
|
quantity?: number
|
|
96
|
+
[k: string]: unknown
|
|
96
97
|
}[]
|
|
97
98
|
/**
|
|
98
99
|
* 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.
|
|
@@ -3,7 +3,6 @@ import type { Settings } from '../generated-types'
|
|
|
3
3
|
import type { Payload } from './generated-types'
|
|
4
4
|
|
|
5
5
|
import { user_properties, params, value, user_id, currency, items_single_products } from '../ga4-properties'
|
|
6
|
-
import { updateUser } from '../ga4-functions'
|
|
7
6
|
|
|
8
7
|
// Change from unknown to the partner SDK types
|
|
9
8
|
const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
@@ -23,12 +22,12 @@ const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
|
23
22
|
params: params
|
|
24
23
|
},
|
|
25
24
|
perform: (gtag, { payload }) => {
|
|
26
|
-
updateUser(payload.user_id, payload.user_properties, gtag)
|
|
27
|
-
|
|
28
25
|
gtag('event', 'remove_from_cart', {
|
|
29
26
|
currency: payload.currency,
|
|
30
27
|
value: payload.value,
|
|
31
28
|
items: payload.items,
|
|
29
|
+
user_id: payload.user_id ?? undefined,
|
|
30
|
+
user_properties: payload.user_properties,
|
|
32
31
|
...payload.params
|
|
33
32
|
})
|
|
34
33
|
}
|
package/src/search/index.ts
CHANGED
|
@@ -3,7 +3,6 @@ import type { Settings } from '../generated-types'
|
|
|
3
3
|
import type { Payload } from './generated-types'
|
|
4
4
|
|
|
5
5
|
import { user_properties, params, user_id, search_term } from '../ga4-properties'
|
|
6
|
-
import { updateUser } from '../ga4-functions'
|
|
7
6
|
|
|
8
7
|
// Change from unknown to the partner SDK types
|
|
9
8
|
const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
@@ -18,10 +17,10 @@ const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
|
18
17
|
search_term: search_term
|
|
19
18
|
},
|
|
20
19
|
perform: (gtag, { payload }) => {
|
|
21
|
-
updateUser(payload.user_id, payload.user_properties, gtag)
|
|
22
|
-
|
|
23
20
|
gtag('event', 'search', {
|
|
24
21
|
search_term: payload.search_term,
|
|
22
|
+
user_id: payload.user_id ?? undefined,
|
|
23
|
+
user_properties: payload.user_properties,
|
|
25
24
|
...payload.params
|
|
26
25
|
})
|
|
27
26
|
}
|
|
@@ -93,6 +93,7 @@ export interface Payload {
|
|
|
93
93
|
* Item quantity.
|
|
94
94
|
*/
|
|
95
95
|
quantity?: number
|
|
96
|
+
[k: string]: unknown
|
|
96
97
|
}[]
|
|
97
98
|
/**
|
|
98
99
|
* 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.
|
package/src/selectItem/index.ts
CHANGED
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
item_list_name,
|
|
11
11
|
item_list_id
|
|
12
12
|
} from '../ga4-properties'
|
|
13
|
-
import { updateUser } from '../ga4-functions'
|
|
14
13
|
|
|
15
14
|
const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
16
15
|
title: 'Select Item',
|
|
@@ -29,12 +28,12 @@ const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
|
29
28
|
params: params
|
|
30
29
|
},
|
|
31
30
|
perform: (gtag, { payload }) => {
|
|
32
|
-
updateUser(payload.user_id, payload.user_properties, gtag)
|
|
33
|
-
|
|
34
31
|
gtag('event', 'select_item', {
|
|
35
32
|
item_list_id: payload.item_list_id,
|
|
36
33
|
item_list_name: payload.item_list_name,
|
|
37
34
|
items: payload.items,
|
|
35
|
+
user_id: payload.user_id ?? undefined,
|
|
36
|
+
user_properties: payload.user_properties,
|
|
38
37
|
...payload.params
|
|
39
38
|
})
|
|
40
39
|
}
|
|
@@ -121,6 +121,7 @@ export interface Payload {
|
|
|
121
121
|
* The ID of the promotion associated with the event.
|
|
122
122
|
*/
|
|
123
123
|
promotion_id?: string
|
|
124
|
+
[k: string]: unknown
|
|
124
125
|
}[]
|
|
125
126
|
/**
|
|
126
127
|
* 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.
|
|
@@ -14,8 +14,6 @@ import {
|
|
|
14
14
|
user_properties,
|
|
15
15
|
location_id
|
|
16
16
|
} from '../ga4-properties'
|
|
17
|
-
import { updateUser } from '../ga4-functions'
|
|
18
|
-
|
|
19
17
|
const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
20
18
|
title: 'Select Promotion',
|
|
21
19
|
description: 'This event signifies a promotion was selected from a list.',
|
|
@@ -50,8 +48,6 @@ const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
|
50
48
|
params: params
|
|
51
49
|
},
|
|
52
50
|
perform: (gtag, { payload }) => {
|
|
53
|
-
updateUser(payload.user_id, payload.user_properties, gtag)
|
|
54
|
-
|
|
55
51
|
gtag('event', 'select_promotion', {
|
|
56
52
|
creative_name: payload.creative_name,
|
|
57
53
|
creative_slot: payload.creative_slot,
|
|
@@ -59,6 +55,8 @@ const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
|
59
55
|
promotion_id: payload.promotion_id,
|
|
60
56
|
promotion_name: payload.promotion_name,
|
|
61
57
|
items: payload.items,
|
|
58
|
+
user_id: payload.user_id ?? undefined,
|
|
59
|
+
user_properties: payload.user_properties,
|
|
62
60
|
...payload.params
|
|
63
61
|
})
|
|
64
62
|
}
|
package/src/signUp/index.ts
CHANGED
|
@@ -3,7 +3,6 @@ import type { Settings } from '../generated-types'
|
|
|
3
3
|
import type { Payload } from './generated-types'
|
|
4
4
|
|
|
5
5
|
import { user_properties, params, user_id, method } from '../ga4-properties'
|
|
6
|
-
import { updateUser } from '../ga4-functions'
|
|
7
6
|
|
|
8
7
|
const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
9
8
|
title: 'Sign Up',
|
|
@@ -17,10 +16,10 @@ const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
|
17
16
|
params: params
|
|
18
17
|
},
|
|
19
18
|
perform: (gtag, { payload }) => {
|
|
20
|
-
updateUser(payload.user_id, payload.user_properties, gtag)
|
|
21
|
-
|
|
22
19
|
gtag('event', 'sign_up', {
|
|
23
20
|
method: payload.method,
|
|
21
|
+
user_id: payload.user_id ?? undefined,
|
|
22
|
+
user_properties: payload.user_properties,
|
|
24
23
|
...payload.params
|
|
25
24
|
})
|
|
26
25
|
}
|
|
@@ -93,6 +93,7 @@ export interface Payload {
|
|
|
93
93
|
* Item quantity.
|
|
94
94
|
*/
|
|
95
95
|
quantity?: number
|
|
96
|
+
[k: string]: unknown
|
|
96
97
|
}[]
|
|
97
98
|
/**
|
|
98
99
|
* 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.
|
package/src/viewCart/index.ts
CHANGED
|
@@ -3,7 +3,6 @@ import type { Settings } from '../generated-types'
|
|
|
3
3
|
import type { Payload } from './generated-types'
|
|
4
4
|
|
|
5
5
|
import { user_properties, params, currency, value, user_id, items_multi_products } from '../ga4-properties'
|
|
6
|
-
import { updateUser } from '../ga4-functions'
|
|
7
6
|
|
|
8
7
|
const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
9
8
|
title: 'View Cart',
|
|
@@ -22,12 +21,12 @@ const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
|
22
21
|
params: params
|
|
23
22
|
},
|
|
24
23
|
perform: (gtag, { payload }) => {
|
|
25
|
-
updateUser(payload.user_id, payload.user_properties, gtag)
|
|
26
|
-
|
|
27
24
|
gtag('event', 'view_cart', {
|
|
28
25
|
currency: payload.currency,
|
|
29
26
|
value: payload.value,
|
|
30
27
|
items: payload.items,
|
|
28
|
+
user_id: payload.user_id ?? undefined,
|
|
29
|
+
user_properties: payload.user_properties,
|
|
31
30
|
...payload.params
|
|
32
31
|
})
|
|
33
32
|
}
|
|
@@ -93,6 +93,7 @@ export interface Payload {
|
|
|
93
93
|
* Item quantity.
|
|
94
94
|
*/
|
|
95
95
|
quantity?: number
|
|
96
|
+
[k: string]: unknown
|
|
96
97
|
}[]
|
|
97
98
|
/**
|
|
98
99
|
* 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.
|
package/src/viewItem/index.ts
CHANGED
|
@@ -3,7 +3,6 @@ import type { Settings } from '../generated-types'
|
|
|
3
3
|
import type { Payload } from './generated-types'
|
|
4
4
|
|
|
5
5
|
import { user_properties, params, currency, user_id, value, items_single_products } from '../ga4-properties'
|
|
6
|
-
import { updateUser } from '../ga4-functions'
|
|
7
6
|
|
|
8
7
|
const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
9
8
|
title: 'View Item',
|
|
@@ -23,12 +22,12 @@ const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
|
23
22
|
params: params
|
|
24
23
|
},
|
|
25
24
|
perform: (gtag, { payload }) => {
|
|
26
|
-
updateUser(payload.user_id, payload.user_properties, gtag)
|
|
27
|
-
|
|
28
25
|
gtag('event', 'view_item', {
|
|
29
26
|
currency: payload.currency,
|
|
30
27
|
value: payload.value,
|
|
31
28
|
items: payload.items,
|
|
29
|
+
user_id: payload.user_id ?? undefined,
|
|
30
|
+
user_properties: payload.user_properties,
|
|
32
31
|
...payload.params
|
|
33
32
|
})
|
|
34
33
|
}
|
|
@@ -93,6 +93,7 @@ export interface Payload {
|
|
|
93
93
|
* Item quantity.
|
|
94
94
|
*/
|
|
95
95
|
quantity?: number
|
|
96
|
+
[k: string]: unknown
|
|
96
97
|
}[]
|
|
97
98
|
/**
|
|
98
99
|
* 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.
|
|
@@ -3,7 +3,6 @@ import type { Settings } from '../generated-types'
|
|
|
3
3
|
import type { Payload } from './generated-types'
|
|
4
4
|
|
|
5
5
|
import { user_properties, params, user_id, items_multi_products, item_list_name, item_list_id } from '../ga4-properties'
|
|
6
|
-
import { updateUser } from '../ga4-functions'
|
|
7
6
|
|
|
8
7
|
const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
9
8
|
title: 'View Item List',
|
|
@@ -22,12 +21,12 @@ const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
|
22
21
|
params: params
|
|
23
22
|
},
|
|
24
23
|
perform: (gtag, { payload }) => {
|
|
25
|
-
updateUser(payload.user_id, payload.user_properties, gtag)
|
|
26
|
-
|
|
27
24
|
gtag('event', 'view_item_list', {
|
|
28
25
|
item_list_id: payload.item_list_id,
|
|
29
26
|
item_list_name: payload.item_list_name,
|
|
30
27
|
items: payload.items,
|
|
28
|
+
user_id: payload.user_id ?? undefined,
|
|
29
|
+
user_properties: payload.user_properties,
|
|
31
30
|
...payload.params
|
|
32
31
|
})
|
|
33
32
|
}
|
|
@@ -121,6 +121,7 @@ export interface Payload {
|
|
|
121
121
|
* The ID of the promotion associated with the event.
|
|
122
122
|
*/
|
|
123
123
|
promotion_id?: string
|
|
124
|
+
[k: string]: unknown
|
|
124
125
|
}[]
|
|
125
126
|
/**
|
|
126
127
|
* 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.
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
user_properties,
|
|
14
14
|
location_id
|
|
15
15
|
} from '../ga4-properties'
|
|
16
|
-
import { updateUser } from '../ga4-functions'
|
|
17
16
|
|
|
18
17
|
const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
19
18
|
title: 'View Promotion',
|
|
@@ -50,8 +49,6 @@ const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
|
50
49
|
params: params
|
|
51
50
|
},
|
|
52
51
|
perform: (gtag, { payload }) => {
|
|
53
|
-
updateUser(payload.user_id, payload.user_properties, gtag)
|
|
54
|
-
|
|
55
52
|
gtag('event', 'view_promotion', {
|
|
56
53
|
creative_name: payload.creative_name,
|
|
57
54
|
creative_slot: payload.creative_slot,
|
|
@@ -59,6 +56,8 @@ const action: BrowserActionDefinition<Settings, Function, Payload> = {
|
|
|
59
56
|
promotion_id: payload.promotion_id,
|
|
60
57
|
promotion_name: payload.promotion_name,
|
|
61
58
|
items: payload.items,
|
|
59
|
+
user_id: payload.user_id ?? undefined,
|
|
60
|
+
user_properties: payload.user_properties,
|
|
62
61
|
...payload.params
|
|
63
62
|
})
|
|
64
63
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function updateUser(userID: string | undefined, userProps: object | undefined, gtag: Function): void;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateUser = void 0;
|
|
4
|
-
function updateUser(userID, userProps, gtag) {
|
|
5
|
-
if (userID) {
|
|
6
|
-
gtag('set', { user_id: userID });
|
|
7
|
-
}
|
|
8
|
-
if (userProps) {
|
|
9
|
-
gtag('set', { user_properties: userProps });
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.updateUser = updateUser;
|
|
13
|
-
//# sourceMappingURL=ga4-functions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ga4-functions.js","sourceRoot":"","sources":["../../src/ga4-functions.ts"],"names":[],"mappings":";;;AAAA,SAAgB,UAAU,CAAC,MAA0B,EAAE,SAA6B,EAAE,IAAc;IAClG,IAAI,MAAM,EAAE;QACV,IAAI,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAA;KACjC;IACD,IAAI,SAAS,EAAE;QACb,IAAI,CAAC,KAAK,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC,CAAA;KAC5C;AACH,CAAC;AAPD,gCAOC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function updateUser(userID: string | undefined, userProps: object | undefined, gtag: Function): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ga4-functions.js","sourceRoot":"","sources":["../../src/ga4-functions.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU,CAAC,MAA0B,EAAE,SAA6B,EAAE,IAAc;IAClG,IAAI,MAAM,EAAE;QACV,IAAI,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAA;KACjC;IACD,IAAI,SAAS,EAAE;QACb,IAAI,CAAC,KAAK,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC,CAAA;KAC5C;AACH,CAAC"}
|
package/src/ga4-functions.ts
DELETED