Skip to content

Commit 1aadc72

Browse files
authored
Switch to Google Analytics (#268)
* Disable Firebase analytics by default * Replace Matomo with Firebase analytics * Update google-services.json * Only track resumed screens * Replace tracker screen paths with slugs * Update the changelog
1 parent 831edad commit 1aadc72

33 files changed

+486
-353
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
- USDT, USDC, ETH and WBTC tokens from the default token set
88

9+
### Changed
10+
11+
- Analytics is now collected through Firebase (Google Analytics)
12+
913
## [1.8.1] - 2025-04-07
1014

1115
### Fixed

app/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,11 @@ dependencies {
341341
implementation group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-xml', version: '2.10.1'
342342
implementation 'javax.xml.stream:stax-api:1.0-2'
343343

344-
// Matomo analytics
345-
implementation 'com.github.matomo-org:matomo-sdk-android:4.1.4'
344+
// Analytics (version lock for Kotlin version compatibility)
345+
implementation 'com.google.firebase:firebase-analytics:21.6.2!!'
346346

347-
// Push notifications
348-
implementation 'com.google.firebase:firebase-messaging:24.0.0'
347+
// Push notifications (version lock for Kotlin version compatibility)
348+
implementation 'com.google.firebase:firebase-messaging:24.0.0!!'
349349
implementation 'com.google.android.gms:play-services-location:21.3.0'
350350

351351
// Lottie animations

app/google-services.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"project_info": {
33
"project_number": "124880082147",
44
"project_id": "concordiummobilewallet",
5-
"storage_bucket": "concordiummobilewallet.appspot.com"
5+
"storage_bucket": "concordiummobilewallet.firebasestorage.app"
66
},
77
"client": [
88
{
@@ -64,4 +64,4 @@
6464
}
6565
],
6666
"configuration_version": "1"
67-
}
67+
}

app/src/main/AndroidManifest.xml

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
android:name="com.google.firebase.messaging.default_notification_icon"
3636
android:resource="@drawable/ic_notification" />
3737

38+
<meta-data
39+
android:name="google_analytics_automatic_screen_reporting_enabled"
40+
android:value="false" />
41+
3842
<service
3943
android:name=".core.notifications.FcmNotificationsService"
4044
android:exported="false">
@@ -67,8 +71,8 @@
6771
android:name=".ui.tokens.add_provider.AddProviderActivity"
6872
android:exported="false"
6973
android:screenOrientation="portrait"
70-
android:windowSoftInputMode="adjustResize"
71-
android:theme="@style/MW24_Screen" />
74+
android:theme="@style/MW24_Screen"
75+
android:windowSoftInputMode="adjustResize" />
7276
<activity
7377
android:name=".ui.connect.ConnectActivity"
7478
android:excludeFromRecents="true"
@@ -257,8 +261,8 @@
257261
android:launchMode="singleTop"
258262
android:parentActivityName=".ui.MainActivity"
259263
android:screenOrientation="portrait"
260-
android:windowSoftInputMode="stateAlwaysVisible|adjustResize"
261-
android:theme="@style/MW24_Screen" />
264+
android:theme="@style/MW24_Screen"
265+
android:windowSoftInputMode="stateAlwaysVisible|adjustResize" />
262266
<activity
263267
android:name=".ui.account.newaccountidentity.NewAccountIdentityActivity"
264268
android:launchMode="singleTop"
@@ -286,8 +290,8 @@
286290
android:launchMode="singleTop"
287291
android:parentActivityName=".ui.cis2.SendTokenActivity"
288292
android:screenOrientation="portrait"
289-
android:windowSoftInputMode="adjustResize"
290-
android:theme="@style/MW24_Screen"/>
293+
android:theme="@style/MW24_Screen"
294+
android:windowSoftInputMode="adjustResize" />
291295
<activity
292296
android:name=".ui.transaction.transactiondetails.TransactionDetailsActivity"
293297
android:launchMode="singleTop"
@@ -469,8 +473,8 @@
469473
android:name=".ui.bakerdelegation.baker.BakerPoolSettingsActivity"
470474
android:launchMode="singleTop"
471475
android:screenOrientation="portrait"
472-
android:windowSoftInputMode="adjustPan|stateHidden"
473-
android:theme="@style/MW24_Screen" />
476+
android:theme="@style/MW24_Screen"
477+
android:windowSoftInputMode="adjustPan|stateHidden" />
474478
<activity
475479
android:name=".ui.bakerdelegation.baker.BakerStatusActivity"
476480
android:launchMode="singleTop"
@@ -550,43 +554,47 @@
550554
android:name=".ui.more.notifications.NotificationsPreferencesActivity"
551555
android:launchMode="singleTop"
552556
android:screenOrientation="portrait"
553-
android:theme="@style/MW24_Screen"/>
557+
android:theme="@style/MW24_Screen" />
554558
<activity
555559
android:name=".ui.tokens.provider.NFTActivity"
556560
android:launchMode="singleTop"
557561
android:screenOrientation="portrait"
558-
android:theme="@style/MW24_Screen"/>
562+
android:theme="@style/MW24_Screen" />
559563
<activity
560564
android:name=".ui.account.accountslist.AccountsListActivity"
561565
android:launchMode="singleTop"
562566
android:screenOrientation="portrait"
563-
android:theme="@style/MW24_Screen"/>
564-
<activity android:name=".ui.cis2.manage.ManageTokenListActivity"
567+
android:theme="@style/MW24_Screen" />
568+
<activity
569+
android:name=".ui.cis2.manage.ManageTokenListActivity"
565570
android:launchMode="singleTask"
566571
android:screenOrientation="portrait"
567-
android:theme="@style/MW24_Screen"/>
568-
<activity android:name=".ui.cis2.manage.AddTokenActivity"
572+
android:theme="@style/MW24_Screen" />
573+
<activity
574+
android:name=".ui.cis2.manage.AddTokenActivity"
569575
android:launchMode="singleTop"
570576
android:screenOrientation="portrait"
571-
android:theme="@style/MW24_Screen"/>
572-
<activity android:name=".ui.cis2.manage.AddTokenDetailsActivity"
577+
android:theme="@style/MW24_Screen" />
578+
<activity
579+
android:name=".ui.cis2.manage.AddTokenDetailsActivity"
573580
android:launchMode="singleTop"
574581
android:screenOrientation="portrait"
575-
android:theme="@style/MW24_Screen"/>
576-
<activity android:name=".ui.account.accountdetails.transfers.AccountDetailsTransfersActivity"
582+
android:theme="@style/MW24_Screen" />
583+
<activity
584+
android:name=".ui.account.accountdetails.transfers.AccountDetailsTransfersActivity"
577585
android:launchMode="singleTop"
578586
android:screenOrientation="portrait"
579-
android:theme="@style/MW24_Screen"/>
587+
android:theme="@style/MW24_Screen" />
580588
<activity
581589
android:name=".ui.multiwallet.WalletsActivity"
582590
android:launchMode="singleTop"
583591
android:screenOrientation="portrait"
584-
android:theme="@style/MW24_Screen"/>
592+
android:theme="@style/MW24_Screen" />
585593
<activity
586594
android:name=".ui.cis2.SelectTokenActivity"
587595
android:launchMode="singleTop"
588596
android:screenOrientation="portrait"
589-
android:theme="@style/MW24_Screen"/>
597+
android:theme="@style/MW24_Screen" />
590598
</application>
591599

592600
</manifest>

app/src/main/java/com/concordium/wallet/App.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import com.concordium.wallet.core.notifications.AnnouncementNotificationManager
77
import com.concordium.wallet.data.backend.price.tokenPriceModule
88
import com.concordium.wallet.data.backend.ws.WsCreds
99
import com.concordium.wallet.util.Log
10+
import com.google.firebase.ktx.Firebase
11+
import com.google.firebase.messaging.ktx.messaging
1012
import com.reown.android.Core
1113
import com.reown.android.CoreClient
1214
import com.reown.android.relay.ConnectionType
@@ -54,6 +56,7 @@ class App : Application() {
5456
}
5557

5658
fun initAppCore() {
59+
Firebase.messaging
5760
appCore = AppCore(this@App)
5861
}
5962

app/src/main/java/com/concordium/wallet/core/AppCore.kt

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import com.concordium.wallet.core.gson.RawJsonTypeAdapter
1010
import com.concordium.wallet.core.migration.TwoWalletsMigration
1111
import com.concordium.wallet.core.multiwallet.AppWallet
1212
import com.concordium.wallet.core.tracking.AppTracker
13-
import com.concordium.wallet.core.tracking.MatomoAppTracker
13+
import com.concordium.wallet.core.tracking.FirebaseAppTracker
1414
import com.concordium.wallet.core.tracking.NoOpAppTracker
1515
import com.concordium.wallet.data.AppWalletRepository
1616
import com.concordium.wallet.data.backend.GrpcBackendConfig
@@ -28,12 +28,11 @@ import com.concordium.wallet.data.model.RawJson
2828
import com.concordium.wallet.data.preferences.AppSetupPreferences
2929
import com.concordium.wallet.data.preferences.AppTrackingPreferences
3030
import com.concordium.wallet.data.room.app.AppDatabase
31+
import com.google.firebase.analytics.FirebaseAnalytics
3132
import com.google.gson.Gson
3233
import com.google.gson.GsonBuilder
3334
import kotlinx.coroutines.ensureActive
3435
import kotlinx.coroutines.runBlocking
35-
import org.matomo.sdk.Matomo
36-
import org.matomo.sdk.TrackerBuilder
3736
import java.math.BigInteger
3837
import kotlin.coroutines.resume
3938
import kotlin.coroutines.suspendCoroutine
@@ -49,17 +48,15 @@ class AppCore(val app: App) {
4948
private val notificationsBackendConfig: NotificationsBackendConfig =
5049
NotificationsBackendConfig(gson)
5150
val cryptoLibrary: CryptoLibrary = CryptoLibraryReal(gson)
52-
private val appTrackingPreferences = AppTrackingPreferences(App.appContext)
51+
val appTrackingPreferences = AppTrackingPreferences(App.appContext)
5352
private val noOpAppTracker: AppTracker = NoOpAppTracker()
54-
private val matomoAppTracker: AppTracker by lazy {
55-
TrackerBuilder.createDefault("https://concordium.matomo.cloud/matomo.php", 8)
56-
.build(Matomo.getInstance(App.appContext))
57-
.let(::MatomoAppTracker)
58-
}
53+
private val firebaseAppTracker: AppTracker = FirebaseAppTracker(
54+
analytics = FirebaseAnalytics.getInstance(app),
55+
)
5956
val tracker: AppTracker
6057
get() =
6158
if (appTrackingPreferences.isTrackingEnabled)
62-
matomoAppTracker
59+
firebaseAppTracker
6360
else
6461
noOpAppTracker
6562

@@ -77,6 +74,10 @@ class AppCore(val app: App) {
7774
}
7875
}
7976
}
77+
78+
FirebaseAnalytics
79+
.getInstance(app)
80+
.setAnalyticsCollectionEnabled(appTrackingPreferences.isTrackingEnabled)
8081
}
8182

8283
val database = AppDatabase.getDatabase(app)

app/src/main/java/com/concordium/wallet/core/tracking/AppTracker.kt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ interface AppTracker {
88
fun welcomeTermAndConditionsCheckBoxChecked()
99
fun welcomeActivityTrackingCheckBoxChecked()
1010
fun welcomeGetStartedClicked()
11-
fun welcomeActivateAccountDialog()
12-
fun welcomeActivateAccountDialogCreateClicked()
13-
fun welcomeActivateAccountDialogImportClicked()
14-
fun welcomePasscodeScreen()
15-
fun welcomePasscodeEntered()
16-
fun welcomePasscodeConfirmationEntered()
17-
fun welcomePasscodeBiometricsDialog()
18-
fun welcomePasscodeBiometricsAccepted()
19-
fun welcomePasscodeBiometricsRejected()
11+
fun welcomeSetUpWalletDialog()
12+
fun welcomeSetUpWalletDialogCreateClicked()
13+
fun welcomeSetUpWalletDialogImportClicked()
14+
fun passcodeScreen()
15+
fun passcodeSetupEntered()
16+
fun passcodeSetupConfirmationEntered()
17+
fun passcodeSetupBiometricsDialog()
18+
fun passcodeSetupBiometricsAccepted()
19+
fun passcodeBiometricsRejected()
2020
fun seedPhraseScreen()
2121
fun seedPhraseCopyClicked()
2222
fun seedPhraseCheckboxBoxChecked()
23-
fun seedPhraseContinueCLicked()
23+
fun seedPhraseContinueClicked()
2424
fun identityVerificationProvidersListScreen()
2525
fun identityVerificationScreen(provider: String)
2626
fun identityVerificationResultScreen()
@@ -31,12 +31,12 @@ interface AppTracker {
3131
fun homeIdentityVerificationClicked()
3232
fun homeIdentityVerificationStateChanged(state: String)
3333
fun homeCreateAccountClicked()
34-
fun homeOnRampScreen()
35-
fun homeOnRampSiteClicked(siteName: String)
36-
fun homeOnRampBannerClicked()
34+
fun homeOnrampScreen()
35+
fun homeOnrampSiteClicked(siteName: String)
36+
fun homeOnrampBannerClicked()
3737
fun homeUnlockFeatureDialog()
3838
fun homeTotalBalanceClicked()
3939
fun aboutScreen()
4040
fun aboutScreenLinkClicked(url: String)
41-
fun homeNewsScreen()
41+
fun discoverScreen()
4242
}

0 commit comments

Comments
 (0)