Skip to content

Commit d866a60

Browse files
committed
Add tracking for browser type.
1 parent ad7ac1b commit d866a60

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

app/src/main/java/com/pr0gramm/app/services/Track.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,21 @@ object Track {
116116
}
117117
}
118118

119+
fun gotoFirefoxFocusWebsite() {
120+
send {
121+
setCategory("FirefoxFocus")
122+
setAction("Website")
123+
}
124+
}
125+
126+
fun openBrowser(type: String) {
127+
send {
128+
setCategory("Browser")
129+
setAction("Open")
130+
setLabel(type)
131+
}
132+
}
133+
119134
fun upload(size: Long) {
120135
val categoryStart = size / (512 * 1024) * 512
121136

app/src/main/java/com/pr0gramm/app/util/BrowserHelper.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import android.support.customtabs.CustomTabsService
1010
import android.support.v4.content.ContextCompat
1111
import com.pr0gramm.app.R
1212
import com.pr0gramm.app.services.ThemeHelper
13+
import com.pr0gramm.app.services.Track
1314
import com.pr0gramm.app.ui.showDialog
1415
import com.thefinestartist.finestwebview.FinestWebView
1516
import java.util.*
@@ -64,14 +65,17 @@ object BrowserHelper {
6465
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
6566
intent.`package` = packageName
6667
context.startActivity(intent)
68+
Track.openBrowser("FirefoxFocus")
6769
return
6870
}
6971

7072
showDialog(context) {
7173
dontShowAgainKey("hint.install-firefox-focus")
7274
content(R.string.hint_use_firefox_focus)
75+
7376
positive(R.string.play_store) {
7477
openCustomTab(context, "https://play.google.com/store/apps/details?id=org.mozilla.klar&hl=en")
78+
Track.gotoFirefoxFocusWebsite()
7579
}
7680

7781
negative(R.string.not_now) {
@@ -85,6 +89,8 @@ object BrowserHelper {
8589
}
8690

8791
private fun openInWebView(context: Context, url: String) {
92+
Track.openBrowser("WebView")
93+
8894
FinestWebView.Builder(context.applicationContext)
8995
.theme(ThemeHelper.theme.noActionBar)
9096
.iconDefaultColor(Color.WHITE)
@@ -104,6 +110,7 @@ object BrowserHelper {
104110
// get the chrome package to use
105111
val packageName = chromeTabPackageName(context)
106112
if (packageName == null) {
113+
Track.openBrowser("External")
107114
context.startActivity(Intent(Intent.ACTION_VIEW, uri))
108115
return
109116
}
@@ -122,5 +129,6 @@ object BrowserHelper {
122129
}
123130

124131
customTabsIntent.launchUrl(themedContext, uri)
132+
Track.openBrowser("CustomTabs")
125133
}
126134
}

app/src/main/res/values/colors.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<color name="stats_fav">#d45099</color>
7575

7676
<color name="type_sfw">#2f9b16</color>
77-
<color name="type_nsfw">#94881e</color>
78-
<color name="type_nsfl">#8c2d8e</color>
77+
<color name="type_nsfw">#c9cc28</color>
78+
<color name="type_nsfl">#843924</color>
7979

8080
</resources>

0 commit comments

Comments
 (0)