summaryrefslogtreecommitdiff
path: root/src/index.js
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/index.js
parentc3d31d95e2875b3a1bcea8bd368dd75bda813ab9 (diff)
downloadbrokentalents-97ec1efce2bdffd7eeadbbb024fc6f3ffaebfb1e.tar.gz
brokentalents-97ec1efce2bdffd7eeadbbb024fc6f3ffaebfb1e.zip
Add GA events
Diffstat (limited to 'src/index.js')
-rw-r--r--src/index.js18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/index.js b/src/index.js
index 18eb719..9f511cf 100644
--- a/src/index.js
+++ b/src/index.js
@@ -3,6 +3,7 @@ import VueRouter from 'vue-router';
import Buefy from 'buefy'
import 'buefy/lib/buefy.css'
import Ads from 'vue-google-adsense';
+import VueAnalytics from 'vue-analytics'
import App from './App.vue';
import ModeTab from './ModeTab.vue';
@@ -12,8 +13,8 @@ import ModeTab from './ModeTab.vue';
Vue.use(VueRouter);
Vue.use(Buefy);
-Vue.use(require('vue-script2'))
-Vue.use(Ads.Adsense)
+Vue.use(require('vue-script2'));
+Vue.use(Ads.Adsense);
const router = new VueRouter({
routes: [ {
@@ -23,14 +24,27 @@ const router = new VueRouter({
} ]
});
+Vue.use(VueAnalytics, {
+ id: 'UA-118868480-1',
+ router,
+ debug: {
+ sendHitTask: process.env.NODE_ENV === 'production',
+ enabled: process.env.NODE_ENV !== 'production',
+ }
+});
+
new Vue({
router,
el: '#app',
render: h => h(App),
mounted: function() {
+ if (window.matchMedia('(display-mode: standalone)').matches || window.navigator.standalone === true) {
+ this.$ga.event('PWA', 'started');
+ }
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/service-worker.js').then((registration) => {
if (typeof registration.update == 'function') {
+ this.$ga.event('PWA', 'update');
registration.update();
}
});