summaryrefslogtreecommitdiff
path: root/src/index.js
diff options
context:
space:
mode:
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();
}
});