-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAnalytics.kt
More file actions
58 lines (44 loc) · 1.42 KB
/
Analytics.kt
File metadata and controls
58 lines (44 loc) · 1.42 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
package com.example.androidsampleapp.analytics
import android.content.Context
import android.util.Log
import com.contentsquare.android.Contentsquare
import com.contentsquare.android.api.model.Transaction
object Analytics {
private val TAG = Analytics::class.java.simpleName
fun tagScreen(screenName: String) {
Log.i(TAG, "Screen: $screenName")
Contentsquare.send(screenName)
}
fun pushTransaction(amount: Float, currency: Int, id: String) {
Contentsquare.send(Transaction.builder(amount, currency).id(id).build())
Log.i(TAG, "Transaction: $amount - ID: $id")
}
fun pushTransaction(amount: Float, currency: String, id: String){
Contentsquare.send(Transaction.builder(amount, currency).id(id).build())
Log.i(TAG, "Transaction: $amount $currency - ID: $id")
}
fun stopTracking() {
Contentsquare.stopTracking()
}
fun resumeTracking() {
Contentsquare.resumeTracking()
}
fun forgetMe() {
Contentsquare.forgetMe()
}
fun optIn(context: Context) {
Contentsquare.optIn(context)
}
fun optOut(context: Context) {
Contentsquare.optOut(context)
}
fun provideUserId(): String {
return Contentsquare.getUserId()
}
fun send(key: String, value: String) {
Contentsquare.send(key, value)
}
fun send(key: String, value: Long) {
Contentsquare.send(key, value)
}
}