Analytics Screen Link Fix

This commit is contained in:
Shabinder Singh 2021-05-31 21:45:03 +05:30
parent 35a25bed84
commit 25ed7dd0b6
2 changed files with 11 additions and 6 deletions

View File

@ -30,6 +30,7 @@ import com.arkivanov.mvikotlin.main.store.DefaultStoreFactory
import com.shabinder.common.di.Dir
import com.shabinder.common.di.DownloadProgressFlow
import com.shabinder.common.di.FetchPlatformQueryResult
import com.shabinder.common.di.firstLaunchDone
import com.shabinder.common.di.initKoin
import com.shabinder.common.di.isFirstLaunch
import com.shabinder.common.di.isInternetAccessible
@ -56,15 +57,15 @@ import javax.swing.JFileChooser.APPROVE_OPTION
private val koin = initKoin(enableNetworkLogs = true).koin
private lateinit var showToast: (String)->Unit
private lateinit var tracker: PiwikTracker
private val tracker: PiwikTracker by lazy {
PiwikTracker("https://kind-grasshopper-73.telebit.io/matomo/matomo.php")
}
fun main() {
val lifecycle = LifecycleRegistry()
lifecycle.resume()
tracker = PiwikTracker("https://kind-grasshopper-73.telebit.io/matomo/matomo.php")
Window("SpotiFlyer",size = IntSize(450,800)) {
Surface(
modifier = Modifier.fillMaxSize(),
@ -148,11 +149,15 @@ private fun spotiFlyerRoot(componentContext: ComponentContext): SpotiFlyerRoot =
}
override val analytics = object: SpotiFlyerRoot.Analytics {
override fun appLaunchEvent() {
// Enable Analytics
directories.toggleAnalytics(true)
if(directories.isFirstLaunch) {
// Enable Analytics on First Launch
directories.toggleAnalytics(true)
directories.firstLaunchDone()
}
tracker.trackAsync {
eventName = "App Launch"
eventAction = "App_Launch"
eventCategory = "events"
}
}

View File

@ -23,7 +23,7 @@ fun PiwikTracker.trackScreenAsync(
) {
val req = PiwikRequest(
1,
URL("https://com.shabinder.spotiflyer/" + screenAddress.removeSurrounding("/"))
URL("https://com.shabinder.spotiflyer$screenAddress")
).apply { requestBuilder() }
// Send Request
sendRequestAsync(req)