Updated on 2026-08-14
This commit is contained in:
parent
369f3bbd44
commit
aee18abe0e
23 changed files with 131 additions and 160 deletions
|
|
@ -1,4 +1,9 @@
|
|||
plugins {
|
||||
alias(deps.plugins.kotlin.jvm)
|
||||
alias(deps.plugins.kotlin.serialization)
|
||||
id("configuration")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api(deps.kotlin.serialization)
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.tangem.core.analytics.models
|
|||
|
||||
import com.tangem.core.analytics.models.AnalyticsParam.Key.REFERRAL
|
||||
import com.tangem.core.analytics.models.AnalyticsParam.Key.REFERRAL_ID
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
const val IS_NOT_HTTP_ERROR = "Is not http error"
|
||||
|
||||
|
|
@ -67,39 +68,40 @@ sealed class AnalyticsParam {
|
|||
data object BlockchainSdk : Error("Blockchain Sdk Error")
|
||||
}
|
||||
|
||||
sealed class ScreensSources(val value: String) {
|
||||
data object Settings : ScreensSources("Settings")
|
||||
data object Main : ScreensSources("Main")
|
||||
data object SignIn : ScreensSources("Sign In")
|
||||
data object Send : ScreensSources("Send")
|
||||
data object Intro : ScreensSources("Introduction")
|
||||
data object MyWallets : ScreensSources("My Wallets")
|
||||
data object Token : ScreensSources("Token")
|
||||
data object Stories : ScreensSources("Stories")
|
||||
data object Buy : ScreensSources("Buy")
|
||||
data object Swap : ScreensSources("Swap")
|
||||
data object Sell : ScreensSources("Sell")
|
||||
data object Backup : ScreensSources("Backup")
|
||||
data object Onboarding : ScreensSources("Onboarding")
|
||||
data object LongTap : ScreensSources("Long Tap")
|
||||
data object Market : ScreensSources("Market")
|
||||
data object Markets : ScreensSources("Markets")
|
||||
data object MarketPulse : ScreensSources("Market Pulse")
|
||||
data object TangemPay : ScreensSources("Tangem Pay")
|
||||
data object WalletSettings : ScreensSources("Wallet Settings")
|
||||
data object Upgrade : ScreensSources("Upgrade")
|
||||
data object HardwareWallet : ScreensSources("Hardware Wallet")
|
||||
data object ImportWallet : ScreensSources("Import Wallet")
|
||||
data object CreateWalletIntro : ScreensSources("Create Wallet Intro")
|
||||
data object AddNewWallet : ScreensSources("Add New Wallet")
|
||||
data object AddNew : ScreensSources("Add New")
|
||||
data object CreateWallet : ScreensSources("Create Wallet")
|
||||
data object NewsList : ScreensSources("News List")
|
||||
data object NewsLink : ScreensSources("News Link")
|
||||
data object NewsPage : ScreensSources("News Page")
|
||||
data object Portfolio : ScreensSources("Portfolio")
|
||||
data object Staking : ScreensSources("Staking")
|
||||
data object Earn : ScreensSources("Earn")
|
||||
@Serializable
|
||||
enum class ScreensSources(val value: String) {
|
||||
Settings("Settings"),
|
||||
Main("Main"),
|
||||
SignIn("Sign In"),
|
||||
Send("Send"),
|
||||
Intro("Introduction"),
|
||||
MyWallets("My Wallets"),
|
||||
Token("Token"),
|
||||
Stories("Stories"),
|
||||
Buy("Buy"),
|
||||
Swap("Swap"),
|
||||
Sell("Sell"),
|
||||
Backup("Backup"),
|
||||
Onboarding("Onboarding"),
|
||||
LongTap("Long Tap"),
|
||||
Market("Market"),
|
||||
Markets("Markets"),
|
||||
MarketPulse("Market Pulse"),
|
||||
TangemPay("Tangem Pay"),
|
||||
WalletSettings("Wallet Settings"),
|
||||
Upgrade("Upgrade"),
|
||||
HardwareWallet("Hardware Wallet"),
|
||||
ImportWallet("Import Wallet"),
|
||||
CreateWalletIntro("Create Wallet Intro"),
|
||||
AddNewWallet("Add New Wallet"),
|
||||
AddNew("Add New"),
|
||||
CreateWallet("Create Wallet"),
|
||||
NewsList("News List"),
|
||||
NewsLink("News Link"),
|
||||
NewsPage("News Page"),
|
||||
Portfolio("Portfolio"),
|
||||
Staking("Staking"),
|
||||
Earn("Earn"),
|
||||
}
|
||||
|
||||
sealed class TxSentFrom(val value: String) {
|
||||
|
|
@ -191,9 +193,9 @@ sealed class AnalyticsParam {
|
|||
}
|
||||
|
||||
sealed class WalletCreationType(val value: String) {
|
||||
data object PrivateKey : WalletCreationType("Private key")
|
||||
data object NewSeed : WalletCreationType("New seed")
|
||||
data object SeedImport : WalletCreationType("Seed import")
|
||||
data object PrivateKey : WalletCreationType(value = "Private Key")
|
||||
data object NewSeed : WalletCreationType(value = "New Seed")
|
||||
data object SeedImport : WalletCreationType(value = "Seed Import")
|
||||
}
|
||||
|
||||
sealed class WalletType(val value: String) {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
package com.tangem.core.analytics.models.event
|
||||
|
||||
import com.tangem.core.analytics.models.AnalyticsEvent
|
||||
import com.tangem.core.analytics.models.AnalyticsParam
|
||||
import com.tangem.core.analytics.models.AppsFlyerIncludedEvent
|
||||
import com.tangem.core.analytics.models.getReferralParams
|
||||
import com.tangem.core.analytics.models.*
|
||||
|
||||
sealed class OnboardingAnalyticsEvent(
|
||||
category: String,
|
||||
|
|
@ -16,23 +13,29 @@ sealed class OnboardingAnalyticsEvent(
|
|||
params: Map<String, String> = mapOf(),
|
||||
) : OnboardingAnalyticsEvent(category = "Onboarding", event = event, params = params) {
|
||||
|
||||
/**
|
||||
* Tracks the start of the onboarding process.
|
||||
*/
|
||||
class Started(
|
||||
source: String,
|
||||
source: AnalyticsParam.ScreensSources? = null,
|
||||
) : Onboarding(
|
||||
event = "Onboarding Started",
|
||||
params = mapOf(
|
||||
AnalyticsParam.SOURCE to source,
|
||||
),
|
||||
)
|
||||
params = buildMap {
|
||||
source?.value?.let { put(AnalyticsParam.SOURCE, it) }
|
||||
},
|
||||
), CriticalEvent
|
||||
|
||||
/**
|
||||
* Tracks the completion of the onboarding process.
|
||||
*/
|
||||
class Finished(
|
||||
source: String,
|
||||
source: AnalyticsParam.ScreensSources? = null,
|
||||
) : Onboarding(
|
||||
event = "Onboarding Finished",
|
||||
params = mapOf(
|
||||
AnalyticsParam.SOURCE to source,
|
||||
),
|
||||
)
|
||||
params = buildMap {
|
||||
source?.value?.let { put(AnalyticsParam.SOURCE, it) }
|
||||
},
|
||||
), CriticalEvent
|
||||
|
||||
class ButtonMobileWallet(
|
||||
source: String,
|
||||
|
|
@ -49,31 +52,42 @@ sealed class OnboardingAnalyticsEvent(
|
|||
params: Map<String, String> = mapOf(),
|
||||
) : OnboardingAnalyticsEvent(category = "Onboarding / Create Wallet", event = event, params = params) {
|
||||
|
||||
class ButtonCreateWallet : CreateWallet("Button - Create Wallet")
|
||||
/**
|
||||
* Tracks opening of the create wallet screen.
|
||||
*/
|
||||
class ScreenOpened : CreateWallet("Create Wallet Screen Opened"), CriticalEvent
|
||||
|
||||
/**
|
||||
* Tracks the user clicking the "Create Wallet" button.
|
||||
*/
|
||||
class ButtonCreateWallet : CreateWallet("Button - Create Wallet"), CriticalEvent
|
||||
|
||||
/**
|
||||
* Tracks the user clicking the "Other Options" button on the create wallet screen.
|
||||
*/
|
||||
class ButtonOtherOptions : CreateWallet("Button - Other Options"), CriticalEvent
|
||||
|
||||
/**
|
||||
* Tracks successful wallet creation, either on a Tangem card or as a mobile wallet.
|
||||
*/
|
||||
class WalletCreatedSuccessfully(
|
||||
source: String,
|
||||
creationType: WalletCreationType = WalletCreationType.NewSeed,
|
||||
creationType: AnalyticsParam.WalletCreationType = AnalyticsParam.WalletCreationType.PrivateKey,
|
||||
seedPhraseLength: Int? = null,
|
||||
passPhraseState: AnalyticsParam.EmptyFull,
|
||||
referralId: String?,
|
||||
source: AnalyticsParam.ScreensSources? = null,
|
||||
) : CreateWallet(
|
||||
event = "Wallet Created Successfully",
|
||||
params = buildMap {
|
||||
put(AnalyticsParam.SOURCE, source)
|
||||
put("Creation Type", creationType.value)
|
||||
put("Passphrase", passPhraseState.value)
|
||||
if (seedPhraseLength != null) {
|
||||
put("Seed Phrase Length", seedPhraseLength.toString())
|
||||
}
|
||||
source?.value?.let { put(AnalyticsParam.SOURCE, it) }
|
||||
putAll(getReferralParams(referralId))
|
||||
},
|
||||
), AppsFlyerIncludedEvent
|
||||
|
||||
sealed class WalletCreationType(val value: String) {
|
||||
data object NewSeed : WalletCreationType(value = "New Seed")
|
||||
data object SeedImport : WalletCreationType(value = "Seed Import")
|
||||
}
|
||||
), AppsFlyerIncludedEvent, CriticalEvent
|
||||
}
|
||||
|
||||
sealed class SeedPhrase(
|
||||
|
|
@ -82,16 +96,19 @@ sealed class OnboardingAnalyticsEvent(
|
|||
) : OnboardingAnalyticsEvent(category = "Onboarding / Seed Phrase", event = event, params = params) {
|
||||
|
||||
class CreateMobileScreenOpened(
|
||||
source: String,
|
||||
source: AnalyticsParam.ScreensSources,
|
||||
) : SeedPhrase(
|
||||
event = "Create Mobile Screen Opened",
|
||||
params = mapOf(
|
||||
AnalyticsParam.SOURCE to source,
|
||||
AnalyticsParam.SOURCE to source.value,
|
||||
),
|
||||
), AppsFlyerIncludedEvent
|
||||
|
||||
class ButtonImportWallet : SeedPhrase("Button - Import Wallet")
|
||||
class ImportSeedPhraseScreenOpened : SeedPhrase("Import Seed Phrase Screen Opened")
|
||||
/**
|
||||
* Tracks opening of the seed phrase import screen.
|
||||
*/
|
||||
class ImportSeedPhraseScreenOpened : SeedPhrase("Import Seed Phrase Screen Opened"), CriticalEvent
|
||||
class ButtonImport : SeedPhrase("Button - Import")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue