Skip to content

Commit

Permalink
feat(Matomo): Add tracking on the transfer type
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianDevel committed Mar 5, 2025
1 parent 6aea808 commit 7f6d265
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Core
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,8 @@ object MatomoSwissTransfer : Matomo {
}
}
}

fun trackTransferTypeEvent(name: String) {
trackEvent("transferType", name)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.infomaniak.multiplatform_swisstransfer.common.interfaces.ui.FileUi
import com.infomaniak.multiplatform_swisstransfer.common.interfaces.upload.UploadSession
import com.infomaniak.swisstransfer.R
import com.infomaniak.swisstransfer.ui.MatomoSwissTransfer
import com.infomaniak.swisstransfer.ui.components.*
import com.infomaniak.swisstransfer.ui.previewparameter.FileUiListPreviewParameter
import com.infomaniak.swisstransfer.ui.screen.main.settings.DownloadLimitOption
Expand Down Expand Up @@ -166,7 +167,10 @@ fun ImportFilesScreen(
transferMessageCallbacks = importFilesViewModel.transferMessageCallbacks,
selectedTransferType = GetSetCallbacks(
get = { selectedTransferType },
set = importFilesViewModel::selectTransferType,
set = { type ->
MatomoSwissTransfer.trackTransferTypeEvent(type.matomoValue)
importFilesViewModel.selectTransferType(type)
},
),
transferOptionsCallbacks = transferOptionsCallbacks,
pickFiles = ::pickFiles,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,34 +72,39 @@ enum class TransferTypeUi(
@StringRes val titleRes: Int,
@StringRes @PluralsRes val descriptionRes: Int?,
val dbValue: TransferType,
val matomoValue: String,
) {
QrCode(
buttonIcon = AppIcons.QrCode,
buttonTextRes = R.string.transferTypeQrCode,
titleRes = R.string.uploadSuccessQrTitle,
descriptionRes = null,
dbValue = TransferType.QR_CODE,
matomoValue = "qrCode",
),
Mail(
buttonIcon = AppIcons.Envelope,
buttonTextRes = R.string.transferTypeEmail,
titleRes = R.string.uploadSuccessEmailTitle,
descriptionRes = R.plurals.uploadSuccessEmailDescription,
dbValue = TransferType.MAIL,
matomoValue = "email",
),
Link(
buttonIcon = AppIcons.Chain,
buttonTextRes = R.string.transferTypeLink,
titleRes = R.string.uploadSuccessLinkTitle,
descriptionRes = R.string.uploadSuccessLinkDescription,
dbValue = TransferType.LINK,
matomoValue = "link",
),
Proximity(
buttonIcon = AppIcons.WifiWave,
buttonTextRes = R.string.transferTypeProximity,
titleRes = R.string.uploadSuccessLinkTitle,
descriptionRes = R.string.uploadSuccessLinkDescription,
dbValue = TransferType.PROXIMITY,
matomoValue = "proximity",
);

companion object {
Expand Down

0 comments on commit 7f6d265

Please sign in to comment.