Add GA track

This commit is contained in:
2020-08-29 23:40:25 +10:00
parent cd61b4dd0a
commit 90fc54491c
2 changed files with 33 additions and 5 deletions
+32 -5
View File
@@ -24,12 +24,29 @@
</b-navbar>
<Nuxt />
<b-row class="row-space footer">
<b-col md="2" offset-md="5">
<div class="copyright">
© 2020 toozhao.com
</div>
<b-col md="4" offset-md="4">
<span class="copyright">
© 2020 toozhao.com <img :src="myBadge" class="my-badge"/>
</span>
</b-col>
</b-row>
<div v-if="isProduction">
<!-- Global site tag (gtag.js) - Google Analytics -->
<script
async
src="https://www.googletagmanager.com/gtag/js?id=UA-5243064-21"
></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());
gtag("config", "UA-5243064-21");
</script>
</div>
</b-overlay>
</template>
@@ -39,8 +56,14 @@ import { mapMutations } from "vuex";
export default Vue.extend({
computed: {
isLoading() {
isLoading(): boolean {
return this.$store.state.loading.loading;
},
isProduction(): boolean {
return this.$config.env == "production";
},
myBadge(): string {
return `${this.$config.myBadge}/green.svg`
}
}
});
@@ -67,6 +90,10 @@ html {
align-items: center;
justify-content: center;
}
.my-badge {
display: inline;
margin-left: 5px;
}
}
*,
*::before,
+1
View File
@@ -67,6 +67,7 @@ export default {
'/api/': process.env.NODE_ENV === 'production' ? 'https://badges.toozhao.com' : 'http://localhost:8080',
},
publicRuntimeConfig: {
env: process.env.NODE_ENV,
baseURL: process.env.BASE_URL || 'http://localhost:3000',
backendURL: process.env.NODE_ENV === 'production' ? 'https://badges.toozhao.com' : 'http://localhost:8080',
myBadge: process.env.NODE_ENV === 'production' ? 'http://localhost:8080/badges/01EGTQ3JBFYS7VZG36SBPM0SA9' : 'https://badges.toozhao.com/badges/01EGTQ64XK7M48A67K9Y62J0QZ'