summaryrefslogtreecommitdiff
path: root/src/InstallNotification.vue
diff options
context:
space:
mode:
Diffstat (limited to 'src/InstallNotification.vue')
-rw-r--r--src/InstallNotification.vue10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/InstallNotification.vue b/src/InstallNotification.vue
index 22e7a8c..a60ec9c 100644
--- a/src/InstallNotification.vue
+++ b/src/InstallNotification.vue
@@ -29,15 +29,25 @@ export default Vue.component('install-notification', {
},
methods: {
promptInstall: function(p) {
+ this.$ga.event('PWA', 'available');
p.preventDefault();
this.deferredPrompt = p;
+ this.deferredPrompt.userChoice.then((choiceResult) => {
+ this.$ga.event('PWA', 'popup', choiceResult.outcome);
+ this.deferredPrompt = null;
+ });
+ },
+ installed: function(e) {
+ this.$ga.event('PWA', 'installed');
},
},
created: function() {
window.addEventListener('beforeinstallprompt', this.promptInstall);
+ window.addEventListener('appinstalled', this.installed);
},
destroyed: function() {
window.removeEventListener('beforeinstallprompt', this.promptInstall);
+ window.removeEventListener('appinstalled', this.installed);
},
});
</script>