Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-2158: Subscription_type ping parameter not sending on login #610

Merged
merged 4 commits into from Oct 2, 2020
Merged
Changes from 1 commit
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

Next

Ensure sign_in_success ping fires for free accounts as well as plus a…

…nd premium
  • Loading branch information
benstrumeyer committed Sep 30, 2020
commit f366dbae86e7c6a705e4db1cd5b46106b7d5168c
@@ -836,9 +836,6 @@ function onMessageHandler(request, sender, callback) {
const { email, password } = message;
account.login(email, password)
.then((response) => {
if (!response.hasOwnProperty('errors')) {
metrics.ping('sign_in_success');
}
callback(response);
})
.catch((err) => {
@@ -22,6 +22,7 @@ import conf from './Conf';
import dispatcher from './Dispatcher';
import { log } from '../utils/common';
import Api from '../utils/api';
import metrics from './Metrics';
import ghosteryDebugger from './Debugger';

const api = new Api();
@@ -87,7 +88,7 @@ class Account {
ghosteryDebugger.addAccountEvent('login', 'cookie set by fetch POST');
this._getUserIDFromCookie().then((userID) => {
this._setAccountInfo(userID);
this.getUserSubscriptionData();
this.getUserSubscriptionData({ calledFrom: 'login'});
});
return {};
});
@@ -168,7 +169,7 @@ class Account {
/**
* @return {array} All subscriptions the user has, empty if none
*/
getUserSubscriptionData = () => (
getUserSubscriptionData = (options) => (
this._getUserID()
.then(userID => api.get('stripe/customers', userID, 'cards,subscriptions'))
.then((res) => {
@@ -197,6 +198,12 @@ class Account {
}

return subscriptions;

})
.finally(() => {
if (options && options.calledFrom === 'login') {
metrics.ping('sign_in_success');
}
})
)

ProTip! Use n and p to navigate between commits in a pull request.