@pbvision/cloud-run-service 0.0.32 → 0.0.33
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 +1 -1
- package/src/analytics.js +10 -3
- package/test/unit-test-analytics.js +4 -2
package/package.json
CHANGED
package/src/analytics.js
CHANGED
|
@@ -147,12 +147,19 @@ export class DatabaseAPIWithAnalytics extends DatabaseAPI {
|
|
|
147
147
|
|
|
148
148
|
function addSenderId (mixpanelUserId, properties, deviceId) {
|
|
149
149
|
if (mixpanelUserId.startsWith('$device:')) {
|
|
150
|
-
properties
|
|
150
|
+
properties.distinct_id = mixpanelUserId
|
|
151
|
+
properties.$device_id = mixpanelUserId.substring(8)
|
|
151
152
|
} else {
|
|
152
|
-
properties.$user_id = mixpanelUserId
|
|
153
|
+
properties.distinct_id = properties.$user_id = mixpanelUserId
|
|
153
154
|
if (deviceId) {
|
|
154
|
-
|
|
155
|
+
// istanbul ignore else
|
|
156
|
+
if (deviceId.startsWith('$device')) {
|
|
157
|
+
properties.$device_id = deviceId.substring(8)
|
|
158
|
+
} else {
|
|
159
|
+
properties.$device_id = deviceId
|
|
160
|
+
}
|
|
155
161
|
}
|
|
156
162
|
}
|
|
163
|
+
properties.distinct_id = mixpanelUserId
|
|
157
164
|
return properties
|
|
158
165
|
}
|
|
@@ -113,7 +113,8 @@ class AnalyticsTest extends AppTest {
|
|
|
113
113
|
properties: expect.objectContaining({
|
|
114
114
|
cool: 1,
|
|
115
115
|
hi: 'world',
|
|
116
|
-
|
|
116
|
+
distinct_id: '$device:xyz',
|
|
117
|
+
$device_id: 'xyz',
|
|
117
118
|
token: mixpanelToken
|
|
118
119
|
})
|
|
119
120
|
}])
|
|
@@ -135,7 +136,8 @@ class AnalyticsTest extends AppTest {
|
|
|
135
136
|
cool: 1,
|
|
136
137
|
hi: 'world',
|
|
137
138
|
$user_id: 'some uid',
|
|
138
|
-
|
|
139
|
+
distinct_id: 'some uid',
|
|
140
|
+
$device_id: 'xyz',
|
|
139
141
|
token: mixpanelToken
|
|
140
142
|
})
|
|
141
143
|
}])
|