Analytics I think?

This commit is contained in:
Kasper Rynning-Tønnesen
2020-01-23 11:18:34 +01:00
parent c414a8137e
commit c974354666
6 changed files with 62 additions and 9 deletions

View File

@@ -1,9 +1,7 @@
<template>
<div class="container">
<h1 class="title">Loddgenerator</h1>
<p class="subtext">
Velg hvilke farger du vil ha, fyll inn antall lodd og klikk 'generer'
</p>
<p class="subtext">Velg hvilke farger du vil ha, fyll inn antall lodd og klikk 'generer'</p>
<div class="input-line">
<label for="redCheckbox">
<input type="checkbox" id="redCheckbox" v-model="redCheckbox" />
@@ -58,6 +56,7 @@
</template>
<script>
import { page, event } from "vue-analytics";
import Vipps from "@/ui/Vipps";
import Banner from "@/ui/Banner";
@@ -86,9 +85,23 @@ export default {
this.generateColors();
}
},
mounted() {
if (window.location.hostname == "localhost") {
return;
}
this.track();
},
methods: {
generateColors: function(event, time) {
if (time == 5) {
if (window.location.hostname == "localhost") {
return;
}
this.$ga.event({
eventCategory: "Ballots",
eventAction: "Generate",
eventValue: JSON.stringify(this.colors)
});
return;
}
if (time == undefined) {
@@ -158,6 +171,9 @@ export default {
if (number == 4) {
return "blue";
}
},
track() {
this.$ga.page("/generate");
}
}
};

View File

@@ -28,6 +28,7 @@
</template>
<script>
import { page, event } from "vue-analytics";
import PurchaseGraph from "@/ui/PurchaseGraph";
import TotalBought from "@/ui/TotalBought";
import Highscore from "@/ui/Highscore";
@@ -45,6 +46,17 @@ export default {
Banner,
Wines,
Vipps
},
mounted() {
if (window.location.hostname == "localhost") {
return;
}
this.track();
},
methods: {
track() {
this.$ga.page("/");
}
}
};
</script>