Skip to content

Commit

Permalink
Add back analytics events for signin
Browse files Browse the repository at this point in the history
  • Loading branch information
dmsnell committed May 7, 2020
1 parent 2fa4079 commit 2eb6470
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/boot-without-auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { Component } from 'react';
import { render } from 'react-dom';
import { Auth as AuthApp } from './auth';
import { Auth as SimperiumAuth } from 'simperium';
import analytics from './analytics';

import getConfig from '../get-config';

Expand Down Expand Up @@ -72,6 +73,7 @@ class AppWithoutAuth extends Component<Props, State> {
throw new Error('missing access token');
}

analytics.tracks.recordEvent('user_account_created');
this.props.onAuth(user.access_token, username, true);
})
.catch(() => {
Expand Down
4 changes: 4 additions & 0 deletions lib/boot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import './utils/ensure-platform-support';

import { parse } from 'cookie';

import analytics from './analytics';
import getConfig from '../get-config';
import { boot as bootWithoutAuth } from './boot-without-auth';
import { isElectron } from './utils/platform';
Expand Down Expand Up @@ -44,6 +45,7 @@ const run = (
import('./boot-with-auth').then(({ bootWithToken }) => {
bootWithToken(
() => {
analytics.tracks.recordEvent('user_signed_out');
localStorage.removeItem('stored_user');
localStorage.removeItem('simpleNote');
indexedDB.deleteDatabase('ghost');
Expand All @@ -68,6 +70,8 @@ const run = (
JSON.stringify({ accessToken: token, username })
);

analytics.tracks.recordEvent('user_signed_in');

run(token, username, false);
}
);
Expand Down

0 comments on commit 2eb6470

Please sign in to comment.