diff --git a/lib/events.ts b/lib/events.ts index 2b78b7eb..d88f2b56 100644 --- a/lib/events.ts +++ b/lib/events.ts @@ -9,12 +9,14 @@ import packageJSON = require('../package.json'); const getBalenaSdk = _.once(() => BalenaSdk.fromSharedOptions()); const getMatchCommandAsync = Promise.promisify(Capitano.state.getMatchCommand); -const getMixpanel = _.once(() => - getBalenaSdk() - .models.config.getAll() - .get('mixpanelToken') - .then(Mixpanel.init), -); +const getMixpanel = _.once(() => { + const settings = require('balena-settings-client'); + return Mixpanel.init('00000000000000000000000000000000', { + host: `api.${settings.get('balenaUrl')}`, + path: '/mixpanel', + protocol: 'https', + }); +}); export function trackCommand(capitanoCli: Capitano.Cli) { const balena = getBalenaSdk(); diff --git a/package.json b/package.json index 0473915f..bb8ccfdd 100644 --- a/package.json +++ b/package.json @@ -96,6 +96,7 @@ "dependencies": { "@resin.io/valid-email": "^0.1.0", "@types/dockerode": "2.5.5", + "@types/mixpanel": "2.14.0", "@types/stream-to-promise": "2.2.0", "@types/through2": "^2.0.33", "@zeit/dockerignore": "0.0.3", @@ -141,7 +142,7 @@ "klaw": "^3.0.0", "lodash": "^4.17.4", "minimatch": "^3.0.4", - "mixpanel": "^0.4.0", + "mixpanel": "^0.10.1", "mkdirp": "^0.5.1", "moment": "^2.20.1", "moment-duration-format": "^2.2.1", diff --git a/typings/mixpanel.d.ts b/typings/mixpanel.d.ts deleted file mode 100644 index 271b8d30..00000000 --- a/typings/mixpanel.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module 'mixpanel';