Skip to content

Commit

Permalink
Introduce feature based tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
hieuwu committed Jan 1, 2024
1 parent a646def commit 733e5b0
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package dev.arkbuilders.navigator.analytics

import dagger.Module
import dagger.Provides
import dev.arkbuilders.navigator.analytics.folders.FoldersAnalytics
import dev.arkbuilders.navigator.analytics.folders.FoldersAnalyticsImpl
import org.matomo.sdk.Tracker
import javax.inject.Singleton

@Module
class AnalyticsModule {

@Singleton
@Provides
fun provideFolderAnalytics(matomoTracker: Tracker): FoldersAnalytics =
FoldersAnalyticsImpl(matomoTracker)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package dev.arkbuilders.navigator.analytics.folders

interface FoldersAnalytics {
fun trackScreen()
fun trackAction()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package dev.arkbuilders.navigator.analytics.folders

import org.matomo.sdk.Tracker
import javax.inject.Inject

class FoldersAnalyticsImpl @Inject constructor(
private val matomoTracker: Tracker
): FoldersAnalytics {

override fun trackScreen() {
TODO("Not yet implemented")
}

override fun trackAction() {
TODO("Not yet implemented")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import dev.arkbuilders.navigator.presentation.screen.resources.adapter.FileItemV
import dev.arkbuilders.navigator.presentation.screen.resources.adapter.ResourcesGridPresenter
import dev.arkbuilders.navigator.presentation.screen.settings.SettingsFragment
import dev.arkbuilders.arkfilepicker.folders.FoldersRepo
import dev.arkbuilders.navigator.analytics.AnalyticsModule
import dev.arkbuilders.navigator.di.modules.DispatcherModule
import javax.inject.Singleton

Expand All @@ -36,6 +37,7 @@ import javax.inject.Singleton
CiceroneModule::class,
RepoModule::class,
DispatcherModule::class,
AnalyticsModule::class,
]
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@ class FoldersFragment : Fragment(R.layout.fragment_folders) {
init()
viewModel.observe(this, state = ::render, sideEffect = ::handleSideEffect)

TrackHelper.track().screen(requireActivity())
.title("Folders management").with(analytics)
TrackHelper.track().screen("Folders").title("Folders management").with(analytics)
TrackHelper.track().event("folder screen", "view sceen")
.name("label").value(1000f).with(analytics)

}

fun init() {
Expand Down

0 comments on commit 733e5b0

Please sign in to comment.