ga: Add a download event to Google Analytics

This commit is contained in:
jduncanator 2020-04-03 10:07:53 +11:00
parent 0a453cfed9
commit 590ea16137
3 changed files with 113 additions and 113 deletions

View file

@ -0,0 +1,33 @@
<template>
<v-tooltip top>
<template v-slot:activator="{ on }">
<v-btn
v-on="on"
class="mx-2"
dark
:color="`ryu_${color}`"
target="_blank"
rel="noopener"
:loading="loading"
:href="href"
@click.once="click"
>
<v-icon class="mx-5">fab fa-{{ platform }}</v-icon>
</v-btn>
</template>
<span>{{ version }}</span>
</v-tooltip>
</template>
<script>
export default {
props: {
platform: String,
color: String,
loading: Boolean,
href: String,
version: String,
click: Function
}
}
</script>

View file

@ -3,6 +3,7 @@ import 'vuetify/dist/vuetify.min.css'
import '~/external/fontawesome/css/fontawesome-all.css'
import DefaultLayout from '~/layouts/Default.vue'
import SEO from '~/components/SEO.vue'
import DownloadButton from '~/components/DownloadButton.vue'
export default function (Vue, { appOptions, head }) {
// First inject custom CSS needed
@ -55,4 +56,7 @@ export default function (Vue, { appOptions, head }) {
// Set the SEO component
Vue.component('SEO', SEO)
// Generic Components
Vue.component('DownloadButton', DownloadButton)
}

View file

@ -19,58 +19,36 @@
</v-col>
<v-col cols="12" md="6">
<p class="mt-4 title">Automatically compiled builds</p>
<v-tooltip top>
<template v-slot:activator="{ on }">
<v-btn
v-on="on"
class="mx-2"
dark
color="ryu_orange"
target="_blank"
rel="noopener"
:loading="isLoading"
<DownloadButton
color="orange"
platform="windows"
:version="version"
:href="`${downloadURL}-win_x64.zip`"
>
<v-icon class="mx-5">fab fa-windows</v-icon>
</v-btn>
</template>
<span>{{ version }}</span>
</v-tooltip>
<v-tooltip top>
<template v-slot:activator="{ on }">
<v-btn
v-on="on"
class="mx-2"
dark
color="ryu_orange"
target="_blank"
rel="noopener"
:click="trackDownload"
:loading="isLoading"
/>
<DownloadButton
color="orange"
platform="linux"
:version="version"
:href="`${downloadURL}-linux_x64.tar.gz`"
>
<v-icon class="mx-5">fab fa-linux</v-icon>
</v-btn>
</template>
<span>{{ version }}</span>
</v-tooltip>
<v-tooltip top>
<template v-slot:activator="{ on }">
<v-btn
v-on="on"
class="mx-2"
dark
color="ryu_orange"
target="_blank"
rel="noopener"
:click="trackDownload"
:loading="isLoading"
/>
<DownloadButton
color="orange"
platform="apple"
:version="version"
:href="`${downloadURL}-osx_x64.zip`"
>
<v-icon class="mx-5">fab fa-apple</v-icon>
</v-btn>
</template>
<span>{{ version }}</span>
</v-tooltip>
:click="trackDownload"
:loading="isLoading"
/>
<br />
<v-btn
text
class="my-2"
@ -83,6 +61,7 @@
src="https://ci.appveyor.com/api/projects/status/ssg4jwu6ve3k594s?svg=true"
/>
</v-btn>
<p class="mt-4 title">
Profiled builds
<br />
@ -90,59 +69,35 @@
class="caption"
>(If you're not a developer, these builds aren't for you.)</span>
</p>
<div class="text-center">
<div v-if="showProfiledBuilds">
<v-tooltip top>
<template v-slot:activator="{ on }">
<v-btn
v-on="on"
class="mx-2"
dark
color="ryu_blue"
target="_blank"
rel="noopener"
:loading="isLoading"
<DownloadButton
color="blue"
platform="windows"
:version="version"
:href="`${downloadURL_profiled}-win_x64.zip`"
>
<v-icon class="mx-5">fab fa-windows</v-icon>
</v-btn>
</template>
<span>{{ this.version }}</span>
</v-tooltip>
<v-tooltip top>
<template v-slot:activator="{ on }">
<v-btn
v-on="on"
class="mx-2"
dark
color="ryu_blue"
target="_blank"
rel="noopener"
:click="trackDownload"
:loading="isLoading"
/>
<DownloadButton
color="blue"
platform="linux"
:version="version"
:href="`${downloadURL_profiled}-linux_x64.tar.gz`"
>
<v-icon class="mx-5">fab fa-linux</v-icon>
</v-btn>
</template>
<span>{{ this.version }}</span>
</v-tooltip>
<v-tooltip top>
<template v-slot:activator="{ on }">
<v-btn
v-on="on"
class="mx-2"
dark
color="ryu_blue"
target="_blank"
rel="noopener"
:click="trackDownload"
:loading="isLoading"
/>
<DownloadButton
color="blue"
platform="apple"
:version="version"
:href="`${downloadURL_profiled}-osx_x64.zip`"
>
<v-icon class="mx-5">fab fa-apple</v-icon>
</v-btn>
</template>
<span>{{ this.version }}</span>
</v-tooltip>
:click="trackDownload"
:loading="isLoading"
/>
</div>
<div v-else>
<v-btn
@ -208,6 +163,14 @@ export default {
this.downloadURL_profiled = `https://ci.appveyor.com/api/buildjobs/${jobIdProfiled}/artifacts/ryujinx-profiled-${this.version}`;
this.isLoading = false;
},
trackDownload() {
this.$ga.event({
eventCategory: 'release',
eventAction: 'download',
eventLabel: this.version
});
}
},