mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
Added analytics to front. Fixed group plan tracking (#10262)
This commit is contained in:
committed by
Sabe Jones
parent
ace02893e5
commit
4b9af8aa86
@@ -373,6 +373,11 @@ export default {
|
|||||||
document.title = title;
|
document.title = title;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.$nextTick(() => {
|
||||||
|
// Load external scripts after the app has been rendered
|
||||||
|
Analytics.load();
|
||||||
|
});
|
||||||
|
|
||||||
if (this.isUserLoggedIn && !this.isStaticPage) {
|
if (this.isUserLoggedIn && !this.isStaticPage) {
|
||||||
// Load the user and the user tasks
|
// Load the user and the user tasks
|
||||||
Promise.all([
|
Promise.all([
|
||||||
@@ -395,7 +400,6 @@ export default {
|
|||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
// Load external scripts after the app has been rendered
|
// Load external scripts after the app has been rendered
|
||||||
setupPayments();
|
setupPayments();
|
||||||
Analytics.load();
|
|
||||||
});
|
});
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error('Impossible to fetch user. Clean up localStorage and refresh.', err); // eslint-disable-line no-console
|
console.error('Impossible to fetch user. Clean up localStorage and refresh.', err); // eslint-disable-line no-console
|
||||||
|
|||||||
@@ -73,7 +73,6 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import * as Analytics from 'client/libs/analytics';
|
|
||||||
import hello from 'hellojs';
|
import hello from 'hellojs';
|
||||||
import { setUpAxios } from 'client/libs/auth';
|
import { setUpAxios } from 'client/libs/auth';
|
||||||
|
|
||||||
@@ -104,13 +103,6 @@ export default {
|
|||||||
// windows: WINDOWS_CLIENT_ID,
|
// windows: WINDOWS_CLIENT_ID,
|
||||||
google: process.env.GOOGLE_CLIENT_ID, // eslint-disable-line
|
google: process.env.GOOGLE_CLIENT_ID, // eslint-disable-line
|
||||||
});
|
});
|
||||||
|
|
||||||
Analytics.track({
|
|
||||||
hitType: 'event',
|
|
||||||
eventCategory: 'group-plans-static',
|
|
||||||
eventAction: 'view',
|
|
||||||
eventLabel: 'view-auth-form',
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async socialAuth (network) {
|
async socialAuth (network) {
|
||||||
|
|||||||
@@ -126,14 +126,6 @@ export default {
|
|||||||
return Boolean(this.newGroup.name);
|
return Boolean(this.newGroup.name);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted () {
|
|
||||||
Analytics.track({
|
|
||||||
hitType: 'event',
|
|
||||||
eventCategory: 'group-plans-static',
|
|
||||||
eventAction: 'view',
|
|
||||||
eventLabel: 'create-group',
|
|
||||||
});
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
changePage (page) {
|
changePage (page) {
|
||||||
Analytics.track({
|
Analytics.track({
|
||||||
|
|||||||
@@ -195,6 +195,7 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import * as Analytics from 'client/libs/analytics';
|
||||||
import { setup as setupPayments } from 'client/libs/payments';
|
import { setup as setupPayments } from 'client/libs/payments';
|
||||||
import amazonPaymentsModal from 'client/components/payments/amazonModal';
|
import amazonPaymentsModal from 'client/components/payments/amazonModal';
|
||||||
import StaticHeader from './header.vue';
|
import StaticHeader from './header.vue';
|
||||||
@@ -227,10 +228,24 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
goToNewGroupPage () {
|
goToNewGroupPage () {
|
||||||
|
Analytics.track({
|
||||||
|
hitType: 'event',
|
||||||
|
eventCategory: 'group-plans-static',
|
||||||
|
eventAction: 'view',
|
||||||
|
eventLabel: 'view-auth-form',
|
||||||
|
});
|
||||||
|
|
||||||
this.$root.$emit('bv::show::modal', 'group-plan');
|
this.$root.$emit('bv::show::modal', 'group-plan');
|
||||||
},
|
},
|
||||||
authenticate () {
|
authenticate () {
|
||||||
this.modalPage = 'purchaseGroup';
|
this.modalPage = 'purchaseGroup';
|
||||||
|
|
||||||
|
Analytics.track({
|
||||||
|
hitType: 'event',
|
||||||
|
eventCategory: 'group-plans-static',
|
||||||
|
eventAction: 'view',
|
||||||
|
eventLabel: 'create-group',
|
||||||
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -138,4 +138,4 @@ export function load () {
|
|||||||
gaScript.async = 1;
|
gaScript.async = 1;
|
||||||
gaScript.src = '//www.google-analytics.com/analytics.js';
|
gaScript.src = '//www.google-analytics.com/analytics.js';
|
||||||
firstScript.parentNode.insertBefore(gaScript, firstScript);
|
firstScript.parentNode.insertBefore(gaScript, firstScript);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user