fix: respect do not track setting

This commit is contained in:
Sean Yesmunt 2019-02-05 13:36:40 -05:00
parent 5e8404b32c
commit 41ead382d1
3 changed files with 14 additions and 6 deletions

View file

@ -70,6 +70,16 @@ const analytics: Analytics = {
.catch(() => {});
}
},
apiLogSearch: () => {
if (analyticsEnabled) {
Lbryio.call('event', 'search');
}
},
apiLogPublish: () => {
if (analyticsEnabled) {
Lbryio.call('event', 'publish');
}
},
};
export default analytics;

View file

@ -9,7 +9,7 @@ import {
doSearch,
doToast,
} from 'lbry-redux';
import { Lbryio } from 'lbryinc';
import analytics from 'analytics';
import { makeSelectClientSetting } from 'redux/selectors/settings';
import * as settings from 'constants/settings';
import { doNavigate } from 'redux/actions/navigation';
@ -35,8 +35,7 @@ const perform = dispatch => ({
onSearch: (query, size) => {
dispatch(doSearch(query, size));
dispatch(doNavigate(`/search`, { query }));
// Ideally this would live inside doSearch, but lbry-redux does not have access to lbryinc
Lbryio.call('event', 'search');
analytics.apiLogSearch();
},
onSubmit: (uri, extraParams) => dispatch(doNavigate('/show', { uri, ...extraParams })),
updateSearchQuery: query => dispatch(doUpdateSearchQuery(query)),

View file

@ -19,12 +19,12 @@ import {
selectMyClaimsWithoutChannels,
doError,
} from 'lbry-redux';
import { Lbryio } from 'lbryinc';
import { doOpenModal } from 'redux/actions/app';
import { selectosNotificationsEnabled } from 'redux/selectors/settings';
import { doNavigate } from 'redux/actions/navigation';
import fs from 'fs';
import path from 'path';
import analytics from 'analytics';
type Action = UpdatePublishFormAction | { type: ACTIONS.CLEAR_PUBLISH };
@ -274,8 +274,7 @@ export const doPublish = (params: PublishParams) => (
dispatch({ type: ACTIONS.PUBLISH_START });
const success = pendingClaim => {
Lbryio.call('event', 'publish');
analytics.apiLogPublish();
const actions = [];
actions.push({