Init or stop posthog based on user consent
This commit is contained in:
parent
fb23350b62
commit
09c2c3dea1
3 changed files with 10 additions and 9 deletions
|
|
@ -30,7 +30,7 @@ interface AnalyticsProvider: AnalyticsTracker, ErrorTracker {
|
|||
*/
|
||||
val name: String
|
||||
|
||||
suspend fun init()
|
||||
fun init()
|
||||
|
||||
fun stop()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class PosthogAnalyticsProvider @Inject constructor(
|
|||
private var posthog: PostHog? = null
|
||||
private var analyticsId: String? = null
|
||||
|
||||
override suspend fun init() {
|
||||
override fun init() {
|
||||
posthog = createPosthog()
|
||||
posthog?.optOut(false)
|
||||
identifyPostHog()
|
||||
|
|
@ -66,10 +66,10 @@ class PosthogAnalyticsProvider @Inject constructor(
|
|||
}
|
||||
|
||||
override fun updateUserProperties(userProperties: UserProperties) {
|
||||
posthog?.identify(
|
||||
REUSE_EXISTING_ID, userProperties.getProperties()?.toPostHogUserProperties(),
|
||||
IGNORED_OPTIONS
|
||||
)
|
||||
// posthog?.identify(
|
||||
// REUSE_EXISTING_ID, userProperties.getProperties()?.toPostHogUserProperties(),
|
||||
// IGNORED_OPTIONS
|
||||
// )
|
||||
}
|
||||
|
||||
override fun trackError(throwable: Throwable) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue