forked from angelaigreja/react-native-piwik
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
49 lines (49 loc) · 1.18 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
let Matomo = require('react-native').NativeModules.Matomo;
module.exports = {
initTracker: Matomo.initTracker,
setUserId (userId) {
if (userId !== null && userId !== userId !== undefined) {
Matomo.setUserId(`${userId}`);
}
},
setCustomDimension (id, value) {
Matomo.setCustomDimension(id, value ? (`${value}`) : null);
},
trackAppDownload: Matomo.trackAppDownload,
trackScreen (path, title) {
Matomo.trackScreen(path, title);
},
trackGoal (goalId, revenue) {
Matomo.trackGoal(goalId, { revenue });
},
trackEvent (category, action, name, value, url) {
Matomo.trackEvent(category, action, {
name,
value,
url,
});
},
trackCampaign (name, keyword) {
Matomo.trackCampaign(name, keyword);
},
trackContentImpression (name, piece, target) {
Matomo.trackContentImpression(name, {
piece,
target,
});
},
trackContentInteraction (name, interaction, piece, target) {
Matomo.trackContentInteraction(name, {
interaction,
piece,
target,
});
},
trackSearch (query, category, resultCount, url) {
Matomo.trackSearch(query, {
category,
resultCount,
url,
});
},
};