-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MOB-516 Add NavigatePage event #114
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package exchange.dydx.trading.feature.shared.analytics | ||
|
||
import android.os.Bundle | ||
import exchange.dydx.trading.integration.analytics.tracking.Tracking | ||
import javax.inject.Inject | ||
import javax.inject.Singleton | ||
|
||
@Singleton | ||
class RoutingAnalytics @Inject constructor( | ||
private val tracker: Tracking, | ||
) { | ||
fun logRoute( | ||
destinationRoute: String, | ||
arguments: Bundle? | ||
) { | ||
var pathWithArguments = destinationRoute | ||
if (pathWithArguments.startsWith("market/{marketId}")) { | ||
// web does not have a /market/<MARKET> path | ||
pathWithArguments = pathWithArguments.replace("market/{marketId}", "trade/{marketId}") | ||
} | ||
arguments?.keySet()?.forEach { key -> | ||
pathWithArguments = pathWithArguments.replace("{$key}", arguments.getString(key) ?: "") | ||
} | ||
if (!pathWithArguments.startsWith("/")) { | ||
// Android routes don't start with "/" | ||
pathWithArguments = "/$pathWithArguments" | ||
} | ||
|
||
tracker.view( | ||
screenName = pathWithArguments, | ||
screenClass = "TradingActivity", | ||
) | ||
|
||
tracker.log( | ||
event = AnalyticsEvent.NAVIGATE_PAGE.rawValue, | ||
data = mapOf( | ||
"path" to pathWithArguments, | ||
), | ||
) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,8 @@ class AmplitudeTracker( | |
val jsonMap = data?.jsonStringToMap() | ||
amplitude.track(event, jsonMap) | ||
} | ||
|
||
override fun view(screenName: String, screenClass: String) { | ||
// No op | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why no-op here? it'd be nice to log these to amplitude as well. afaik we don't ingest Firebase events into Mode, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's tracked on Amplitude with line 34 from RoutingAnalytics |
||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need singleton here, this class doesn't hold any of it's own state