forked from yelled3/react-native-segment-io-analytics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRNSegmentIOAnalytics.ios.js
More file actions
92 lines (79 loc) · 2.39 KB
/
RNSegmentIOAnalytics.ios.js
File metadata and controls
92 lines (79 loc) · 2.39 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/**
* @providesModule RNSegmentIOAnalytics
* @flow
*
* Created by Tal Kain <tal@kain.net>.
* Copyright (c) 2015 Fire Place Inc. All rights reserved.
*/
'use strict';
var NativeRNSegmentIOAnalytics = require('react-native').NativeModules.RNSegmentIOAnalytics;
/**
* RNSegmentIOAnalytics is a React Native iOS wrapper for the Segment.com Analytics SDK.
*/
var RNSegmentIOAnalytics = {
/*
* Setting up the Segment IO Analytics service
*
* @param configKey https://segment.com/docs/libraries/ios/#configuration
* @param flushAt https://segment.com/docs/libraries/ios/#flushing
* @param shouldUseLocationServices https://segment.com/docs/libraries/ios/#location-services
*/
setup: function (configKey, flushAt = 20, shouldUseLocationServices = false, debug = false) {
NativeRNSegmentIOAnalytics.setup(configKey, flushAt, shouldUseLocationServices, debug);
},
/*
* https://segment.com/docs/libraries/ios/#identify
*/
identifyUser: function (userId, traits) {
NativeRNSegmentIOAnalytics.identifyUser(userId, traits);
},
/*
* https://segment.com/docs/libraries/ios/#alias
*/
alias: function (newId) {
NativeRNSegmentIOAnalytics.alias(newId);
},
/*
* https://segment.com/docs/libraries/ios/#track
*/
track: function (trackText, properties) {
NativeRNSegmentIOAnalytics.track(trackText, properties);
},
/*
* https://segment.com/docs/libraries/ios/#screen
*/
screen: function (screenName, properties) {
NativeRNSegmentIOAnalytics.screen(screenName, properties);
},
/*
* https://segment.com/docs/libraries/ios/#reset
*/
reset: function () {
NativeRNSegmentIOAnalytics.reset();
},
/*
* https://segment.com/docs/libraries/ios/#flushing
*/
flush: function () {
NativeRNSegmentIOAnalytics.flush();
},
/*
* https://segment.com/docs/libraries/ios/#logging
*/
debug: function (isEnabled) {
NativeRNSegmentIOAnalytics.debug(isEnabled);
},
/*
* https://segment.com/docs/libraries/ios/#opt-out
*/
disable: function () {
NativeRNSegmentIOAnalytics.disable();
},
/*
* https://segment.com/docs/libraries/ios/#opt-out
*/
enable: function () {
NativeRNSegmentIOAnalytics.enable();
},
};
module.exports = RNSegmentIOAnalytics;