summaryrefslogtreecommitdiff
path: root/src/InstallNotification.vue
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2018-06-08 19:50:41 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2018-12-13 17:09:16 +0100
commit97ec1efce2bdffd7eeadbbb024fc6f3ffaebfb1e (patch)
treed506f5a011067ae2bd0b5cfe7113740db1e26596 /src/InstallNotification.vue
parentc3d31d95e2875b3a1bcea8bd368dd75bda813ab9 (diff)
downloadbrokentalents-97ec1efce2bdffd7eeadbbb024fc6f3ffaebfb1e.tar.gz
brokentalents-97ec1efce2bdffd7eeadbbb024fc6f3ffaebfb1e.zip
Add GA events
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>