@blotoutio/providers-google-analytics-4-sdk 0.11.0 → 0.12.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/index.js +10 -12
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -28,20 +28,18 @@ var ProvidersGoogleAnalytics4Sdk = (function () {
|
|
|
28
28
|
if (window.gtag) {
|
|
29
29
|
window.gtag('config', manifest.variables['measurementId'], {
|
|
30
30
|
user_id: userId,
|
|
31
|
+
send_page_view: false,
|
|
31
32
|
});
|
|
32
33
|
}
|
|
33
34
|
};
|
|
34
35
|
|
|
35
|
-
const getItems = (contents = []
|
|
36
|
+
const getItems = (contents = []) => {
|
|
36
37
|
return contents.map((content) => {
|
|
37
38
|
const data = {
|
|
38
39
|
item_id: content.id,
|
|
39
40
|
item_name: content.title,
|
|
40
41
|
quantity: content.quantity || 1,
|
|
41
42
|
};
|
|
42
|
-
if (currency) {
|
|
43
|
-
data['currency'] = currency.toUpperCase();
|
|
44
|
-
}
|
|
45
43
|
if (content.category) {
|
|
46
44
|
data['item_category'] = content.category;
|
|
47
45
|
}
|
|
@@ -65,7 +63,7 @@ var ProvidersGoogleAnalytics4Sdk = (function () {
|
|
|
65
63
|
eventData: {
|
|
66
64
|
currency: data['currency'],
|
|
67
65
|
value: data['value'],
|
|
68
|
-
items: getItems(data['contents']
|
|
66
|
+
items: getItems(data['contents']),
|
|
69
67
|
},
|
|
70
68
|
};
|
|
71
69
|
}
|
|
@@ -75,7 +73,7 @@ var ProvidersGoogleAnalytics4Sdk = (function () {
|
|
|
75
73
|
eventData: {
|
|
76
74
|
currency: data['currency'],
|
|
77
75
|
value: data['value'],
|
|
78
|
-
items: getItems(data['contents']
|
|
76
|
+
items: getItems(data['contents']),
|
|
79
77
|
},
|
|
80
78
|
};
|
|
81
79
|
}
|
|
@@ -85,7 +83,7 @@ var ProvidersGoogleAnalytics4Sdk = (function () {
|
|
|
85
83
|
eventData: {
|
|
86
84
|
currency: data['currency'],
|
|
87
85
|
value: data['value'],
|
|
88
|
-
items: getItems(data['contents']
|
|
86
|
+
items: getItems(data['contents']),
|
|
89
87
|
},
|
|
90
88
|
};
|
|
91
89
|
}
|
|
@@ -95,7 +93,7 @@ var ProvidersGoogleAnalytics4Sdk = (function () {
|
|
|
95
93
|
eventData: {
|
|
96
94
|
currency: data['currency'],
|
|
97
95
|
value: data['value'],
|
|
98
|
-
items: getItems(data['contents']
|
|
96
|
+
items: getItems(data['contents']),
|
|
99
97
|
},
|
|
100
98
|
};
|
|
101
99
|
}
|
|
@@ -105,7 +103,7 @@ var ProvidersGoogleAnalytics4Sdk = (function () {
|
|
|
105
103
|
eventData: {
|
|
106
104
|
currency: data['currency'],
|
|
107
105
|
value: data['value'],
|
|
108
|
-
items: getItems(data['contents']
|
|
106
|
+
items: getItems(data['contents']),
|
|
109
107
|
},
|
|
110
108
|
};
|
|
111
109
|
}
|
|
@@ -116,7 +114,7 @@ var ProvidersGoogleAnalytics4Sdk = (function () {
|
|
|
116
114
|
currency: data['currency'],
|
|
117
115
|
transaction_id: data['orderId'] || eventId,
|
|
118
116
|
value: data['value'],
|
|
119
|
-
items: getItems(data['contents']
|
|
117
|
+
items: getItems(data['contents']),
|
|
120
118
|
},
|
|
121
119
|
};
|
|
122
120
|
}
|
|
@@ -153,7 +151,7 @@ var ProvidersGoogleAnalytics4Sdk = (function () {
|
|
|
153
151
|
if (manifestVariables && manifestVariables['measurementId']) {
|
|
154
152
|
eventData['send_to'] = manifestVariables['measurementId'];
|
|
155
153
|
}
|
|
156
|
-
window.gtag('event', event, eventData);
|
|
154
|
+
window.gtag('event', event, Object.assign(Object.assign({}, eventData), { app: 'blotout' }));
|
|
157
155
|
};
|
|
158
156
|
|
|
159
157
|
const getCookieValue = (key) => {
|
|
@@ -187,7 +185,7 @@ var ProvidersGoogleAnalytics4Sdk = (function () {
|
|
|
187
185
|
}
|
|
188
186
|
return {
|
|
189
187
|
loaded: isLoaded,
|
|
190
|
-
sdkVersion: "0.
|
|
188
|
+
sdkVersion: "0.12.0" ,
|
|
191
189
|
};
|
|
192
190
|
};
|
|
193
191
|
|