Skip to content

Commit

Permalink
Merge pull request #415 from MetaMask/feat/detect-all-wallets
Browse files Browse the repository at this point in the history
Feat/detect all wallets
  • Loading branch information
kevin-chassagne authored Sep 5, 2024
2 parents 88d4bb9 + 1a3a63e commit 0528d30
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/lib/services/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,35 @@ const WRITE_KEY = (params.env == "production") ? PROD_WRITE_KEY : DEV_WRITE_KEY;
// identify user by anonId
analytics.identify(atob(params.mmi));
analytics.track('App Uninstalled', {
app_version: params.av
app_version: params.av,
wallets_installed: window.walletsInstalled.split(','),
});
}
}}();
window.addEventListener('load', setupSurvey)
function setupSurvey() {
const checkboxes = document.getElementsByName('reasons')
const submitSurveyButton = document.getElementById('submitSurvey')
const uninstallSurvey = document.getElementById('uninstall_survey')
const checkboxes = document.getElementsByName('reasons')
const submitSurveyButton = document.getElementById('submitSurvey')
const uninstallSurvey = document.getElementById('uninstall_survey')
checkboxes.forEach(checkbox => {
checkboxes.forEach(checkbox => {
checkbox.onchange = checkReasons
})
})
if (submitSurveyButton) {
if (submitSurveyButton) {
submitSurveyButton.addEventListener('click', submitSurvey)
}
}
function checkReasons() {
function checkReasons() {
const checkedCount = Array.from(checkboxes).filter(
checkbox => checkbox.checked
).length
submitSurveyButton.disabled = checkedCount === 0
}
}
function submitSurvey() {
function submitSurvey() {
const reasons = Array.from(checkboxes)
.filter(checkbox => checkbox.checked)
.map(checkbox => checkbox.value)
Expand All @@ -48,12 +49,12 @@ function setupSurvey() {
analytics.track('Survey Submitted', {
survey_type: 'mm_ext_uninstall',
field_reason: reasons,
wallets_installed: window.walletsInstalled,
wallets_installed: window.walletsInstalled.split(','),
})
uninstallSurvey.innerHTML = 'Thank you for your feedback.'
}
}
}
}
`

Expand Down

0 comments on commit 0528d30

Please sign in to comment.