1
0
Fork 0

For #11655: add leanplum event for installing an addon (#12136) r=elise

* For #11655: add leanplum event for installing an addon

* Add link to data-review request in PR

* Addressed CI comments
master
jhugman 2020-07-12 22:47:34 +00:00 committed by GitHub
parent 31248b835c
commit 9df13ae121
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 1 deletions

View File

@ -29,8 +29,10 @@ import mozilla.components.feature.addons.ui.AddonsManagerAdapterDelegate
import mozilla.components.feature.addons.ui.PermissionsDialogFragment
import mozilla.components.feature.addons.ui.translatedName
import org.mozilla.fenix.R
import org.mozilla.fenix.components.metrics.Event
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.getRootView
import org.mozilla.fenix.ext.requireComponents
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.ext.showToolbar
import org.mozilla.fenix.theme.ThemeManager
@ -192,11 +194,13 @@ class AddonsManagementFragment : Fragment(R.layout.fragment_add_ons_management),
onPositiveButtonClicked = onPositiveButtonClicked
)
dialog.show(parentFragmentManager, PERMISSIONS_DIALOG_FRAGMENT_TAG)
requireContext().components.analytics.metrics.track(Event.AddonInstalled(addon.id))
}
}
private fun showInstallationDialog(addon: Addon) {
if (!isInstallationInProgress && !hasExistingAddonInstallationDialogFragment()) {
requireComponents.analytics.metrics.track(Event.AddonInstalled(addon.id))
val addonCollectionProvider = requireContext().components.addonCollectionProvider
val dialog = AddonInstallationDialogFragment.newInstance(

View File

@ -650,6 +650,7 @@ private val Event.wrapper: EventWrapper<*>?
is Event.ClearedPrivateData -> null
is Event.DismissedOnboarding -> null
is Event.FennecToFenixMigrated -> null
is Event.AddonInstalled -> null
}
class GleanMetricsService(private val context: Context) : MetricsService {

View File

@ -38,9 +38,10 @@ private val Event.name: String?
is Event.ClearedPrivateData -> "E_Cleared_Private_Data"
is Event.DismissedOnboarding -> "E_Dismissed_Onboarding"
is Event.FennecToFenixMigrated -> "E_Fennec_To_Fenix_Migrated"
is Event.AddonInstalled -> "E_Addon_Installed"
// Do not track other events in Leanplum
else -> ""
else -> null
}
class LeanplumMetricsService(private val application: Application) : MetricsService {

View File

@ -465,6 +465,8 @@ sealed class Event {
}
object CrashReporterOpened : Event()
data class AddonInstalled(val addonId: String) : Event()
data class CrashReporterClosed(val crashSubmitted: Boolean) : Event() {
override val extras: Map<CrashReporter.closedKeys, String>?
get() = mapOf(CrashReporter.closedKeys.crashSubmitted to crashSubmitted.toString())

View File

@ -231,6 +231,11 @@ Here is the list of current Events sent, which can be found here in the code bas
<td>The user has just migrated from Fennec to Fenix.</td>
<td><a href="https://github.com/mozilla-mobile/fenix/pull/8208#issuecomment-584040440">#8208</a></td>
</tr>
<tr>
<td>`E_Addon_Installed`</td>
<td>The user has installed an addon from the addon management page.</td>
<td><a href="https://github.com/mozilla-mobile/fenix/pull/12136#issuecomment-651922547">#12136</a></td>
</tr>
</table>
Deep links