Merge pull request #2268 from lbryio/do-not-track

Respect "do not track" setting for search/publish events
This commit is contained in:
Sean Yesmunt 2019-02-05 14:02:39 -05:00 committed by GitHub
commit 8467dbdac3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 7 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({

View file

@ -90,7 +90,7 @@
&.navigation__link--guide:not(:hover) {
color: rgba($lbry-black, 0.75);
html[data-theme='dark'] {
html[data-theme='dark'] & {
color: rgba($lbry-white, 0.75);
}