mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
remove google analytics
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
"@babel/core": "^7.22.10",
|
||||
"@babel/preset-env": "^7.22.10",
|
||||
"@babel/register": "^7.22.15",
|
||||
"@google-analytics/data": "^4.12.1",
|
||||
"@google-cloud/trace-agent": "^7.1.2",
|
||||
"@parse/node-apn": "^5.2.3",
|
||||
"@slack/webhook": "^6.1.0",
|
||||
|
||||
@@ -5,7 +5,6 @@ import Vue from 'vue';
|
||||
import getStore from '@/store';
|
||||
|
||||
const DEBUG_ENABLED = import.meta.env.DEBUG_ENABLED === 'true';
|
||||
const GA_ID = import.meta.env.GA_ID;
|
||||
const IS_PRODUCTION = import.meta.env.NODE_ENV === 'production';
|
||||
|
||||
const REQUIRED_FIELDS = ['eventCategory', 'eventAction'];
|
||||
@@ -66,14 +65,6 @@ export function track (properties, options = {}) {
|
||||
// Use nextTick to avoid blocking the UI
|
||||
Vue.nextTick(() => {
|
||||
if (_doesNotHaveRequiredFields(properties)) return;
|
||||
|
||||
const trackOnClient = options && options.trackOnClient === true;
|
||||
// Track events on the server by default
|
||||
if (trackOnClient === true) {
|
||||
if (window.gtag) {
|
||||
window.gtag('event', properties.eventAction, properties);
|
||||
}
|
||||
}
|
||||
const store = getStore();
|
||||
store.dispatch('analytics:trackEvent', properties);
|
||||
});
|
||||
@@ -85,20 +76,7 @@ export function updateUser (properties = {}) {
|
||||
// Use nextTick to avoid blocking the UI
|
||||
Vue.nextTick(() => {
|
||||
_gatherUserStats(properties);
|
||||
if (window.gtag) {
|
||||
window.gtag('set', 'user_properties', properties);
|
||||
}
|
||||
const store = getStore();
|
||||
store.dispatch('analytics:updateUserProperties', properties);
|
||||
});
|
||||
}
|
||||
|
||||
export async function setup () {
|
||||
const user = _getConsentedUser();
|
||||
if (!user) return;
|
||||
await Vue.loadScript(`https://www.googletagmanager.com/gtag/js?id=${GA_ID}`);
|
||||
window.gtag('config', GA_ID, {
|
||||
debug_mode: DEBUG_ENABLED || !IS_PRODUCTION,
|
||||
user_id: user._id,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import axios from 'axios';
|
||||
import { authAsCredentialsState, LOCALSTORAGE_AUTH_KEY } from '@/libs/auth';
|
||||
|
||||
const GA_ID = import.meta.env.GA_ID;
|
||||
|
||||
function saveLocalDataAuth (store, apiId, apiToken) {
|
||||
const credentialsObj = {
|
||||
auth: {
|
||||
@@ -123,9 +121,6 @@ export async function appleAuth (store, params) {
|
||||
export function logout (store, options = {}) {
|
||||
localStorage.clear();
|
||||
sessionStorage.clear();
|
||||
if (window.gtag) {
|
||||
window.gtag('config', GA_ID, { user_id: null });
|
||||
}
|
||||
const query = options.redirectToLogin === true ? '?redirectToLogin=true' : '';
|
||||
window.location.href = `/logout-server${query}`;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ const envVars = [
|
||||
'EMAILS_COMMUNITY_MANAGER_EMAIL',
|
||||
'EMAILS_TECH_ASSISTANCE_EMAIL',
|
||||
'EMAILS_PRESS_ENQUIRY_EMAIL',
|
||||
'GA_ID',
|
||||
'STRIPE_PUB_KEY',
|
||||
'GOOGLE_CLIENT_ID',
|
||||
'APPLE_AUTH_CLIENT_ID',
|
||||
|
||||
@@ -261,7 +261,7 @@ function _updateProperties (properties, uuid) {
|
||||
.catch(err => logger.error(err, 'Error while sending data to Amplitude.'));
|
||||
}
|
||||
|
||||
// There's no error handling directly here because it's handled inside _sendDataTo{Amplitude|Google}
|
||||
// There's no error handling directly here because it's handled inside _sendDataToAmplitude
|
||||
async function track (eventType, data, loggerOnly = false) {
|
||||
const { user } = data;
|
||||
if (!user || !user.preferences || !user.preferences.analyticsConsent) {
|
||||
@@ -280,7 +280,7 @@ async function track (eventType, data, loggerOnly = false) {
|
||||
}
|
||||
|
||||
// There's no error handling directly here because
|
||||
// it's handled inside _sendPurchaseDataTo{Amplitude|Google}
|
||||
// it's handled inside _sendPurchaseDataToAmplitude
|
||||
async function trackPurchase (data) {
|
||||
const { user } = data;
|
||||
if (!user || !user.preferences || !user.preferences.analyticsConsent) {
|
||||
|
||||
Reference in New Issue
Block a user