diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2018-06-08 19:50:41 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2018-12-13 17:09:16 +0100 |
| commit | 97ec1efce2bdffd7eeadbbb024fc6f3ffaebfb1e (patch) | |
| tree | d506f5a011067ae2bd0b5cfe7113740db1e26596 /src/InstallNotification.vue | |
| parent | c3d31d95e2875b3a1bcea8bd368dd75bda813ab9 (diff) | |
| download | brokentalents-97ec1efce2bdffd7eeadbbb024fc6f3ffaebfb1e.tar.gz brokentalents-97ec1efce2bdffd7eeadbbb024fc6f3ffaebfb1e.zip | |
Add GA events
Diffstat (limited to 'src/InstallNotification.vue')
| -rw-r--r-- | src/InstallNotification.vue | 10 |
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> |
