diff --git a/src/lib/services/analytics.js b/src/lib/services/analytics.js index b0d68d891bf..fbfa427a869 100644 --- a/src/lib/services/analytics.js +++ b/src/lib/services/analytics.js @@ -10,7 +10,8 @@ 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(','), }); } }}(); @@ -18,26 +19,26 @@ const WRITE_KEY = (params.env == "production") ? PROD_WRITE_KEY : DEV_WRITE_KEY; 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) @@ -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.' } - } + } } `