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(() => {}); .catch(() => {});
} }
}, },
apiLogSearch: () => {
if (analyticsEnabled) {
Lbryio.call('event', 'search');
}
},
apiLogPublish: () => {
if (analyticsEnabled) {
Lbryio.call('event', 'publish');
}
},
}; };
export default analytics; export default analytics;

View file

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

View file

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