Revert "Analytics: track generic events through the server (#12735)"

This reverts commit 48dbe547c0.
This commit is contained in:
Sabe Jones
2020-11-05 15:44:30 -06:00
parent b97d514c68
commit 9d6fb2ca26
16 changed files with 17 additions and 120 deletions

View File

@@ -82,21 +82,14 @@ export function setUser () {
window.ga('set', { userId: user._id });
}
export function track (properties, options = {}) {
export function track (properties) {
// Use nextTick to avoid blocking the UI
Vue.nextTick(() => {
if (_doesNotHaveRequiredFields(properties)) return;
if (_doesNotHaveAllowedHitType(properties)) return;
const trackOnServer = options && options.trackOnServer === true;
if (trackOnServer === true) {
// Track an event on the server
const store = getStore();
store.dispatch('analytics:trackEvent', properties);
} else {
amplitude.getInstance().logEvent(properties.eventAction, properties);
window.ga('send', properties);
}
amplitude.getInstance().logEvent(properties.eventAction, properties);
window.ga('send', properties);
});
}