mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-26 15:18:19 +08:00
Analytics tracker, support report custom properties not yet in schame
This commit is contained in:
parent
72d2199f1a
commit
1f430a4015
@ -23,8 +23,10 @@ import im.vector.app.features.analytics.plan.UserProperties
|
|||||||
interface AnalyticsTracker {
|
interface AnalyticsTracker {
|
||||||
/**
|
/**
|
||||||
* Capture an Event.
|
* Capture an Event.
|
||||||
|
*
|
||||||
|
* @param customProperties Some custom properties to attach to the event.
|
||||||
*/
|
*/
|
||||||
fun capture(event: VectorAnalyticsEvent)
|
fun capture(event: VectorAnalyticsEvent, customProperties: Map<String, Any>? = null)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Track a displayed screen.
|
* Track a displayed screen.
|
||||||
|
@ -171,11 +171,15 @@ class DefaultVectorAnalytics @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun capture(event: VectorAnalyticsEvent) {
|
override fun capture(event: VectorAnalyticsEvent, customProperties: Map<String, Any>?) {
|
||||||
Timber.tag(analyticsTag.value).d("capture($event)")
|
Timber.tag(analyticsTag.value).d("capture($event)")
|
||||||
posthog
|
posthog
|
||||||
?.takeIf { userConsent == true }
|
?.takeIf { userConsent == true }
|
||||||
?.capture(event.getName(), event.getProperties()?.toPostHogProperties())
|
?.capture(
|
||||||
|
event.getName(),
|
||||||
|
(customProperties.orEmpty() +
|
||||||
|
event.getProperties().orEmpty()).toPostHogProperties()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun screen(screen: VectorAnalyticsScreen) {
|
override fun screen(screen: VectorAnalyticsScreen) {
|
||||||
|
Loading…
Reference in New Issue
Block a user