@widergy/mobile-ui 1.18.6 → 1.19.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 +7 -0
- package/lib/utils/analyticsUtils/index.js +58 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [1.19.0](https://github.com/widergy/mobile-ui/compare/v1.18.6...v1.19.0) (2024-08-23)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* event multitracking ([#334](https://github.com/widergy/mobile-ui/issues/334)) ([5364c58](https://github.com/widergy/mobile-ui/commit/5364c58894d65a5b0662393c17d745e5eca40356))
|
|
7
|
+
|
|
1
8
|
## [1.18.6](https://github.com/widergy/mobile-ui/compare/v1.18.5...v1.18.6) (2024-08-23)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* VERSION 5.X.X ONLY, version 6.x.x introduces breaking changes
|
|
5
5
|
* */
|
|
6
6
|
|
|
7
|
+
import { isEmpty, merge } from 'lodash';
|
|
8
|
+
|
|
7
9
|
const LOG_EVENT = 'LOG_EVENT';
|
|
8
10
|
const SET_CURRENT_SCREEN = 'SET_CURRENT_SCREEN';
|
|
9
11
|
const SET_USER_ID = 'SET_USER_ID';
|
|
@@ -65,11 +67,64 @@ export const multiTracking = trackerArgumentsArray =>
|
|
|
65
67
|
createAnalyticsMiddleware(trackerArguments.eventsMapper, trackerArguments.analytics)
|
|
66
68
|
);
|
|
67
69
|
|
|
70
|
+
export const mixpanelUserIdentify = mixpanelInstance => userProfileProperties => {
|
|
71
|
+
const { id } = userProfileProperties;
|
|
72
|
+
if (mixpanelInstance) {
|
|
73
|
+
mixpanelInstance.identify(`${id}`);
|
|
74
|
+
mixpanelInstance.getPeople().set({
|
|
75
|
+
$name: `${id}`,
|
|
76
|
+
$email: null,
|
|
77
|
+
...userProfileProperties
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const mixpanelUserReset = mixpanelInstance => () => {
|
|
83
|
+
if (mixpanelInstance) mixpanelInstance.reset();
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const mixpanelEventsFlush = mixpanelInstance => () => {
|
|
87
|
+
if (mixpanelInstance) mixpanelInstance.flush();
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const singleMixpanelEvent = mixpanelInstance => eventData => {
|
|
91
|
+
const { name, ...yourProperties } = eventData;
|
|
92
|
+
if (mixpanelInstance) mixpanelInstance.track(name, yourProperties);
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const singleFirebaseEvent = analyticsIntance => eventData => {
|
|
96
|
+
const { action, category, currency, label, value } = eventData;
|
|
97
|
+
if (analyticsIntance) analyticsIntance.logEvent(category, { action, currency, label, value });
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export const singleInhouseEvent = sendInhouseAnalytics => eventData => {
|
|
101
|
+
sendInhouseAnalytics(null, eventData);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export const singleEventMultitracking = (trackers, eventDefinitions) => (name, eventData) => {
|
|
105
|
+
const mergedData = merge(eventDefinitions[name] || {}, eventData || {});
|
|
106
|
+
const { sharedProps, ...trackerProps } = mergedData;
|
|
107
|
+
const trackersArray = Object.keys(mergedData);
|
|
108
|
+
if (!isEmpty(trackers))
|
|
109
|
+
trackersArray.forEach(trackerName => {
|
|
110
|
+
const eventTracker = trackers[trackerName];
|
|
111
|
+
const fullEventData = merge(trackerProps[trackerName], sharedProps);
|
|
112
|
+
eventTracker?.(fullEventData);
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
|
|
68
116
|
export default {
|
|
69
117
|
createAnalyticsMiddleware,
|
|
118
|
+
mixpanelEventsFlush,
|
|
119
|
+
mixpanelUserIdentify,
|
|
120
|
+
mixpanelUserReset,
|
|
121
|
+
multiTracking,
|
|
122
|
+
setUserTracking,
|
|
123
|
+
singleEventMultitracking,
|
|
124
|
+
singleFirebaseEvent,
|
|
125
|
+
singleInhouseEvent,
|
|
126
|
+
singleMixpanelEvent,
|
|
70
127
|
tracker,
|
|
71
128
|
trackEvent,
|
|
72
|
-
trackScreen
|
|
73
|
-
setUserTracking,
|
|
74
|
-
multiTracking
|
|
129
|
+
trackScreen
|
|
75
130
|
};
|
package/package.json
CHANGED