Skip to content

Commit 7f6d265

Browse files
committed
feat(Matomo): Add tracking on the transfer type
1 parent 6aea808 commit 7f6d265

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

app/src/main/java/com/infomaniak/swisstransfer/ui/MatomoSwissTransfer.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,8 @@ object MatomoSwissTransfer : Matomo {
4747
}
4848
}
4949
}
50+
51+
fun trackTransferTypeEvent(name: String) {
52+
trackEvent("transferType", name)
53+
}
5054
}

app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/ImportFilesScreen.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
4040
import com.infomaniak.multiplatform_swisstransfer.common.interfaces.ui.FileUi
4141
import com.infomaniak.multiplatform_swisstransfer.common.interfaces.upload.UploadSession
4242
import com.infomaniak.swisstransfer.R
43+
import com.infomaniak.swisstransfer.ui.MatomoSwissTransfer
4344
import com.infomaniak.swisstransfer.ui.components.*
4445
import com.infomaniak.swisstransfer.ui.previewparameter.FileUiListPreviewParameter
4546
import com.infomaniak.swisstransfer.ui.screen.main.settings.DownloadLimitOption
@@ -166,7 +167,10 @@ fun ImportFilesScreen(
166167
transferMessageCallbacks = importFilesViewModel.transferMessageCallbacks,
167168
selectedTransferType = GetSetCallbacks(
168169
get = { selectedTransferType },
169-
set = importFilesViewModel::selectTransferType,
170+
set = { type ->
171+
MatomoSwissTransfer.trackTransferTypeEvent(type.matomoValue)
172+
importFilesViewModel.selectTransferType(type)
173+
},
170174
),
171175
transferOptionsCallbacks = transferOptionsCallbacks,
172176
pickFiles = ::pickFiles,

app/src/main/java/com/infomaniak/swisstransfer/ui/screen/newtransfer/importfiles/components/TransferTypeButtons.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,34 +72,39 @@ enum class TransferTypeUi(
7272
@StringRes val titleRes: Int,
7373
@StringRes @PluralsRes val descriptionRes: Int?,
7474
val dbValue: TransferType,
75+
val matomoValue: String,
7576
) {
7677
QrCode(
7778
buttonIcon = AppIcons.QrCode,
7879
buttonTextRes = R.string.transferTypeQrCode,
7980
titleRes = R.string.uploadSuccessQrTitle,
8081
descriptionRes = null,
8182
dbValue = TransferType.QR_CODE,
83+
matomoValue = "qrCode",
8284
),
8385
Mail(
8486
buttonIcon = AppIcons.Envelope,
8587
buttonTextRes = R.string.transferTypeEmail,
8688
titleRes = R.string.uploadSuccessEmailTitle,
8789
descriptionRes = R.plurals.uploadSuccessEmailDescription,
8890
dbValue = TransferType.MAIL,
91+
matomoValue = "email",
8992
),
9093
Link(
9194
buttonIcon = AppIcons.Chain,
9295
buttonTextRes = R.string.transferTypeLink,
9396
titleRes = R.string.uploadSuccessLinkTitle,
9497
descriptionRes = R.string.uploadSuccessLinkDescription,
9598
dbValue = TransferType.LINK,
99+
matomoValue = "link",
96100
),
97101
Proximity(
98102
buttonIcon = AppIcons.WifiWave,
99103
buttonTextRes = R.string.transferTypeProximity,
100104
titleRes = R.string.uploadSuccessLinkTitle,
101105
descriptionRes = R.string.uploadSuccessLinkDescription,
102106
dbValue = TransferType.PROXIMITY,
107+
matomoValue = "proximity",
103108
);
104109

105110
companion object {

0 commit comments

Comments
 (0)