Client Analytics (#9023)

* start to refactor analytics and some mixins

* wip

* wip

* wip

* more analytics

* more analytics

* more anlytics

* fix analytics module

* finish analytics

* fix env

* vue casing
This commit is contained in:
Matteo Pagliazzi
2017-09-08 21:23:58 +02:00
committed by GitHub
parent 6e70f27bc6
commit 1dc1923d7b
26 changed files with 402 additions and 148 deletions

View File

@@ -409,6 +409,7 @@ import extend from 'lodash/extend';
import groupUtilities from 'client/mixins/groupsUtilities';
import styleHelper from 'client/mixins/styleHelper';
import { mapState } from 'client/libs/store';
import * as Analytics from 'client/libs/analytics';
import membersModal from './membersModal';
import startQuestModal from './startQuestModal';
import quests from 'common/script/content/quests';
@@ -636,7 +637,7 @@ export default {
},
async sendMessage () {
let response = await this.$store.dispatch('chat:postChat', {
groupId: this.group._id,
group: this.group._id,
message: this.newMessage,
});
this.group.chat.unshift(response.message);
@@ -699,7 +700,13 @@ export default {
this.user.guilds.push(this.group._id);
},
clickLeave () {
// Analytics.track({'hitType':'event','eventCategory':'button','eventAction':'click','eventLabel':'Leave Party'});
Analytics.track({
hitType: 'event',
eventCategory: 'button',
eventAction: 'click',
eventLabel: 'Leave Party',
});
// @TODO: Get challenges and ask to keep or remove
if (!confirm('Are you sure you want to leave?')) return;
let keep = true;
@@ -714,12 +721,14 @@ export default {
keepChallenges,
};
if (this.isParty) data.type = 'party';
if (this.isParty) {
data.type = 'party';
Analytics.updateUser({partySize: null, partyID: null});
}
await this.$store.dispatch('guilds:leave', data);
// @TODO: Implement
// Analytics.updateUser({'partySize':null,'partyID':null});
// User.sync().then(function () {
// $rootScope.hardRedirect('/#/options/groups/party');
// });
@@ -743,7 +752,13 @@ export default {
await this.$store.dispatch('guilds:join', {groupId: this.group._id});
},
clickStartQuest () {
// Analytics.track({'hitType':'event','eventCategory':'button','eventAction':'click','eventLabel':'Start a Quest'});
Analytics.track({
hitType: 'event',
eventCategory: 'button',
eventAction: 'click',
eventLabel: 'Start a Quest',
});
let hasQuests = find(this.user.items.quests, (quest) => {
return quest > 0;
});