@mparticle/web-amplitude-kit 2.0.6 → 2.2.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/CHANGELOG.md +16 -0
- package/dist/Amplitude.common.js +82 -63
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
## Releases
|
|
2
2
|
|
|
3
3
|
--
|
|
4
|
+
#### 2.2.0 - 2021-11-03
|
|
5
|
+
|
|
6
|
+
- feat: Support other5-other10 IDs
|
|
7
|
+
|
|
8
|
+
#### 2.1.0 - 2021-08-30
|
|
9
|
+
|
|
10
|
+
- feat: Add support for EU Data Center
|
|
11
|
+
|
|
12
|
+
#### 2.0.8 - 2021-05-26
|
|
13
|
+
|
|
14
|
+
- Generate bundle that was not included in 2.0.7 release
|
|
15
|
+
|
|
16
|
+
#### 2.0.7 - 2021-05-26
|
|
17
|
+
|
|
18
|
+
- fix: Map impression and promotion events to align with server
|
|
19
|
+
|
|
4
20
|
#### 2.0.6 - 2021-04-06
|
|
5
21
|
|
|
6
22
|
- feat: Add includeEmailAsUserProperty and no longer set userIdentities as user properties to align with server
|
package/dist/Amplitude.common.js
CHANGED
|
@@ -49,6 +49,12 @@ var constants = {
|
|
|
49
49
|
other2: 'other2',
|
|
50
50
|
other3: 'other3',
|
|
51
51
|
other4: 'other4',
|
|
52
|
+
other5: 'other5',
|
|
53
|
+
other6: 'other6',
|
|
54
|
+
other7: 'other7',
|
|
55
|
+
other8: 'other8',
|
|
56
|
+
other9: 'other9',
|
|
57
|
+
other10: 'other10',
|
|
52
58
|
};
|
|
53
59
|
|
|
54
60
|
/* eslint-disable */
|
|
@@ -157,7 +163,8 @@ var constructor = function () {
|
|
|
157
163
|
}
|
|
158
164
|
|
|
159
165
|
function onUserIdentified(user) {
|
|
160
|
-
var
|
|
166
|
+
var userId;
|
|
167
|
+
|
|
161
168
|
if (isInitialized) {
|
|
162
169
|
var userIdentities = user.getUserIdentities().userIdentities;
|
|
163
170
|
|
|
@@ -169,67 +176,51 @@ var constructor = function () {
|
|
|
169
176
|
try {
|
|
170
177
|
switch (forwarderSettings.userIdentification) {
|
|
171
178
|
case constants.MPID:
|
|
172
|
-
|
|
179
|
+
userId = user.getMPID();
|
|
180
|
+
break;
|
|
173
181
|
// server returns `customerId` whereas key on userIdentities object is `customerid`
|
|
174
182
|
case constants.customerId:
|
|
175
|
-
|
|
176
|
-
return getInstance().setUserId(
|
|
177
|
-
userIdentities.customerid
|
|
178
|
-
);
|
|
179
|
-
} else {
|
|
180
|
-
userIdMissing = true;
|
|
181
|
-
}
|
|
183
|
+
userId = userIdentities.customerid;
|
|
182
184
|
break;
|
|
183
185
|
case constants.email:
|
|
184
|
-
|
|
185
|
-
return getInstance().setUserId(
|
|
186
|
-
userIdentities.email
|
|
187
|
-
);
|
|
188
|
-
} else {
|
|
189
|
-
userIdMissing = true;
|
|
190
|
-
}
|
|
186
|
+
userId = userIdentities.email;
|
|
191
187
|
break;
|
|
192
188
|
case constants.other:
|
|
193
|
-
|
|
194
|
-
return getInstance().setUserId(
|
|
195
|
-
userIdentities.other
|
|
196
|
-
);
|
|
197
|
-
} else {
|
|
198
|
-
userIdMissing = true;
|
|
199
|
-
}
|
|
189
|
+
userId = userIdentities.other;
|
|
200
190
|
break;
|
|
201
191
|
case constants.other2:
|
|
202
|
-
|
|
203
|
-
return getInstance().setUserId(
|
|
204
|
-
userIdentities.other2
|
|
205
|
-
);
|
|
206
|
-
} else {
|
|
207
|
-
userIdMissing = true;
|
|
208
|
-
}
|
|
192
|
+
userId = userIdentities.other2;
|
|
209
193
|
break;
|
|
210
194
|
case constants.other3:
|
|
211
|
-
|
|
212
|
-
return getInstance().setUserId(
|
|
213
|
-
userIdentities.other3
|
|
214
|
-
);
|
|
215
|
-
} else {
|
|
216
|
-
userIdMissing = true;
|
|
217
|
-
}
|
|
195
|
+
userId = userIdentities.other3;
|
|
218
196
|
break;
|
|
219
197
|
case constants.other4:
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
198
|
+
userId = userIdentities.other4;
|
|
199
|
+
break;
|
|
200
|
+
case constants.other5:
|
|
201
|
+
userId = userIdentities.other5;
|
|
202
|
+
break;
|
|
203
|
+
case constants.other6:
|
|
204
|
+
userId = userIdentities.other6;
|
|
205
|
+
break;
|
|
206
|
+
case constants.other7:
|
|
207
|
+
userId = userIdentities.other7;
|
|
208
|
+
break;
|
|
209
|
+
case constants.other8:
|
|
210
|
+
userId = userIdentities.other8;
|
|
211
|
+
break;
|
|
212
|
+
case constants.other9:
|
|
213
|
+
userId = userIdentities.other9;
|
|
214
|
+
break;
|
|
215
|
+
case constants.other10:
|
|
216
|
+
userId = userIdentities.other10;
|
|
227
217
|
break;
|
|
228
|
-
|
|
229
218
|
default:
|
|
230
|
-
|
|
219
|
+
userId = null;
|
|
231
220
|
}
|
|
232
|
-
if (
|
|
221
|
+
if (userId) {
|
|
222
|
+
return getInstance().setUserId(userId);
|
|
223
|
+
} else {
|
|
233
224
|
console.warn(
|
|
234
225
|
'A user identification type of ' +
|
|
235
226
|
forwarderSettings.userIdentification +
|
|
@@ -347,29 +338,33 @@ var constructor = function () {
|
|
|
347
338
|
);
|
|
348
339
|
}
|
|
349
340
|
|
|
341
|
+
function createEcommerceAttributes(attributes) {
|
|
342
|
+
var updatedAttributes = {};
|
|
343
|
+
for (var key in attributes) {
|
|
344
|
+
if (key !== 'Total Amount' && key !== 'Total Product Amount') {
|
|
345
|
+
updatedAttributes[key] = attributes[key];
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
return convertJsonAttrs(updatedAttributes);
|
|
350
|
+
}
|
|
351
|
+
|
|
350
352
|
function logCommerce(event) {
|
|
353
|
+
var expandedEvents = mParticle.eCommerce.expandCommerceEvent(event);
|
|
351
354
|
if (event.ProductAction) {
|
|
352
|
-
var isRefund
|
|
355
|
+
var isRefund, isPurchase, logRevenue;
|
|
356
|
+
isRefund =
|
|
353
357
|
event.ProductAction.ProductActionType ===
|
|
354
358
|
mParticle.ProductActionType.Refund;
|
|
355
|
-
|
|
359
|
+
isPurchase =
|
|
356
360
|
event.ProductAction.ProductActionType ===
|
|
357
|
-
|
|
358
|
-
|
|
361
|
+
mParticle.ProductActionType.Purchase;
|
|
362
|
+
logRevenue = isRefund || isPurchase;
|
|
359
363
|
expandedEvents.forEach(function (expandedEvt) {
|
|
360
364
|
// Exclude Totals from the attributes as we log it in the revenue call
|
|
361
|
-
var updatedAttributes =
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
key !== 'Total Amount' &&
|
|
365
|
-
key !== 'Total Product Amount'
|
|
366
|
-
) {
|
|
367
|
-
updatedAttributes[key] =
|
|
368
|
-
expandedEvt.EventAttributes[key];
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
updatedAttributes = convertJsonAttrs(updatedAttributes);
|
|
365
|
+
var updatedAttributes = createEcommerceAttributes(
|
|
366
|
+
expandedEvt.EventAttributes
|
|
367
|
+
);
|
|
373
368
|
|
|
374
369
|
// Purchase and Refund events generate an additional 'Total' event
|
|
375
370
|
if (logRevenue && expandedEvt.EventName.indexOf('Total') > -1) {
|
|
@@ -391,6 +386,26 @@ var constructor = function () {
|
|
|
391
386
|
return true;
|
|
392
387
|
}
|
|
393
388
|
|
|
389
|
+
if (
|
|
390
|
+
event.EventCategory ===
|
|
391
|
+
mParticle.CommerceEventType.ProductImpression ||
|
|
392
|
+
event.EventCategory === mParticle.CommerceEventType.PromotionView ||
|
|
393
|
+
event.EventCategory === mParticle.CommerceEventType.PromotionClick
|
|
394
|
+
) {
|
|
395
|
+
expandedEvents.forEach(function (expandedEvt) {
|
|
396
|
+
// Exclude Totals from the attributes as we log it in the revenue call
|
|
397
|
+
var updatedAttributes = createEcommerceAttributes(
|
|
398
|
+
expandedEvt.EventAttributes
|
|
399
|
+
);
|
|
400
|
+
|
|
401
|
+
getInstance().logEvent(
|
|
402
|
+
expandedEvt.EventName,
|
|
403
|
+
updatedAttributes
|
|
404
|
+
);
|
|
405
|
+
});
|
|
406
|
+
return true;
|
|
407
|
+
}
|
|
408
|
+
|
|
394
409
|
return false;
|
|
395
410
|
}
|
|
396
411
|
|
|
@@ -470,6 +485,10 @@ var constructor = function () {
|
|
|
470
485
|
forwarderSettings.forceHttps === 'True';
|
|
471
486
|
}
|
|
472
487
|
|
|
488
|
+
if (forwarderSettings.baseUrl) {
|
|
489
|
+
ampSettings.apiEndpoint = forwarderSettings.baseUrl;
|
|
490
|
+
}
|
|
491
|
+
|
|
473
492
|
isDefaultInstance =
|
|
474
493
|
!forwarderSettings.instanceName ||
|
|
475
494
|
forwarderSettings.instanceName === 'default';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mparticle/web-amplitude-kit",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"author": "mParticle Developers <developers@mparticle.com> (https://www.mparticle.com)",
|
|
5
5
|
"description": "mParticle integration sdk for Amplitude",
|
|
6
6
|
"main": "dist/Amplitude.common.js",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"watchify": "^3.11.1"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@mparticle/web-sdk": "^2.
|
|
40
|
+
"@mparticle/web-sdk": "^2.12.8",
|
|
41
41
|
"isobject": "^4.0.0"
|
|
42
42
|
},
|
|
43
43
|
"license": "Apache-2.0"
|