From 4cb05cb14c700c6c8f9a9371440de57ea8848f14 Mon Sep 17 00:00:00 2001 From: Evan Morikawa Date: Wed, 28 Oct 2015 19:53:31 -0400 Subject: [PATCH] fix(analytics): remove analytics --- package.json | 1 - src/flux/stores/analytics-store.coffee | 93 -------------------------- src/global/nylas-exports.coffee | 1 - 3 files changed, 95 deletions(-) delete mode 100644 src/flux/stores/analytics-store.coffee diff --git a/package.json b/package.json index 8bfbb2781..749863f97 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,6 @@ "juice": "^1.4", "less-cache": "0.21", "marked": "^0.3", - "mixpanel": "0.0.20", "mkdirp": "^0.5", "moment": "^2.8", "moment-timezone": "^0.3", diff --git a/src/flux/stores/analytics-store.coffee b/src/flux/stores/analytics-store.coffee deleted file mode 100644 index 6ea11591a..000000000 --- a/src/flux/stores/analytics-store.coffee +++ /dev/null @@ -1,93 +0,0 @@ -_ = require 'underscore' -Reflux = require 'reflux' -Mixpanel = require 'mixpanel' -qs = require 'querystring' - -Actions = require '../actions' -AccountStore = require './account-store' - -printToConsole = false - -# We white list actions to track. -# -# The Key is the action and the value is the callback function for that -# action. That callback function should return the data we pass along to -# our analytics service based on the sending data. -# -# IMPORTANT: Be VERY careful about what private data we send to our -# analytics service!! -# -# Only completely anonymous data essential to future metrics or -# debugging may be sent. -coreWindowActions = - composeReply: -> ['Compose Draft', {'type': 'reply'}] - composeForward: -> ['Compose Draft', {'type': 'forward'}] - composeReplyAll: -> ['Compose Draft', {'type': 'reply-all'}] - composeNewBlankDraft: -> ['Compose Draft', {'type': 'blank'}] - composePopoutDraft: -> ['Popout Draft', {}] - sendDraft: -> ['Send Draft', {}] - destroyDraft: -> ['Delete Draft', {}] - searchQueryCommitted: (query) -> ['Commit Search Query', {}] - attachFile: -> ['Attach File', {}] - attachFilePath: -> ['Attach File Path', {}] - fetchAndOpenFile: -> ['Download and Open File', {}] - fetchAndSaveFile: -> ['Download and Save File', {}] - abortFetchFile: -> ['Cancel Download', {}] - fileDownloaded: -> ['Download Complete', {}] - -module.exports = -AnalyticsStore = Reflux.createStore - - init: -> - @analytics = Mixpanel.init("9a2137b80c098b3d594e39b776ebe085") - @listenTo AccountStore, => @identify() - @identify() - - @trackActions(Actions, coreWindowActions) - @trackTasks() - - trackActions: (dispatcher, listeners) -> - _.each listeners, (mappingFunction, actionName) => - @listenTo dispatcher[actionName], (args...) => - [eventName, eventArgs] = mappingFunction(args...) - @track(eventName, eventArgs) - - trackTasks: -> - @listenTo Actions.queueTask, (task) => - return unless task - eventName = task.constructor.name - eventArgs = {} - eventArgs['item_count'] = task.messages.length if task.messages? - eventArgs['item_count'] = task.threads.length if task.threads? - @track(eventName, eventArgs) - - track: (eventName, eventArgs={}) -> - _.defer => - # send to the analytics service - @analytics.track(eventName, _.extend(eventArgs, { - platform: process.platform - version: atom.getVersion() - distinct_id: AccountStore.current()?.id - accountId: AccountStore.current()?.id - })) - - # send to the logs that we ship to LogStash - console.debug(printToConsole, {eventName, eventArgs}) - - identify: -> - account = AccountStore.current() - if account - @analytics.people.set(account.id, { - "$email": account.me().email - "$first_name": account.me().firstName() - "$last_name": account.me().lastName() - "accountId": account.id - "platform": process.platform - "provider": account.displayProvider() - "organizational_unit": account.organizationUnit - "version_primary": atom.getVersion().split('-')[0] - "version": atom.getVersion() - }) - @analytics.people.set_once(account.id, { - "First Seen": (new Date()).toISOString() - }) diff --git a/src/global/nylas-exports.coffee b/src/global/nylas-exports.coffee index f305547a5..2d4d51825 100644 --- a/src/global/nylas-exports.coffee +++ b/src/global/nylas-exports.coffee @@ -101,7 +101,6 @@ class NylasExports @require "MessageStore", 'flux/stores/message-store' @require "ContactStore", 'flux/stores/contact-store' @require "CategoryStore", 'flux/stores/category-store' - @require "AnalyticsStore", 'flux/stores/analytics-store' @require "WorkspaceStore", 'flux/stores/workspace-store' @require "DraftCountStore", 'flux/stores/draft-count-store' @require "FileUploadStore", 'flux/stores/file-upload-store'