mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-21 17:05:39 +03:00
Analytics tracker, support report custom properties not yet in schame
This commit is contained in:
parent
72d2199f1a
commit
1f430a4015
2 changed files with 9 additions and 3 deletions
|
@ -23,8 +23,10 @@ import im.vector.app.features.analytics.plan.UserProperties
|
|||
interface AnalyticsTracker {
|
||||
/**
|
||||
* 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.
|
||||
|
|
|
@ -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)")
|
||||
posthog
|
||||
?.takeIf { userConsent == true }
|
||||
?.capture(event.getName(), event.getProperties()?.toPostHogProperties())
|
||||
?.capture(
|
||||
event.getName(),
|
||||
(customProperties.orEmpty() +
|
||||
event.getProperties().orEmpty()).toPostHogProperties()
|
||||
)
|
||||
}
|
||||
|
||||
override fun screen(screen: VectorAnalyticsScreen) {
|
||||
|
|
Loading…
Reference in a new issue