Skip to content

Commit

Permalink
chore: disable countly analytics
Browse files Browse the repository at this point in the history
Minimal changes to hide analytics UI components
and stop sending opt-out metrics to instance which no longer works.

Close #2198
  • Loading branch information
lidel committed Apr 5, 2024
1 parent b560f5c commit 77fcafb
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
14 changes: 13 additions & 1 deletion src/bundles/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,18 @@ import { onlyOnceAfter } from '../lib/hofs/functions.js'
* @property {number} lastDisabledAt
* @property {string[]} consent
* @property {boolean?} showAnalyticsBanner
* @property {boolean?} showAnalyticsComponents
* @property {boolean?} optedOut
*
* @typedef {Object} State
* @property {Model} analytics
*/

// 2024-Q2:
// All analytics are disabled since we no longer use Countly instance.
// See https://github.com/ipfs/ipfs-webui/issues/2198
const DISABLE_ALL_ANALYTICS = true

// Unknown actions (can't seem to see anything
// dispatching those).
const DESKTOP = Enum.from(['DESKTOP_SETTING_TOGGLE'])
Expand Down Expand Up @@ -213,6 +219,11 @@ const selectors = {
* @param {State} state
*/
selectAnalyticsOptedOut: (state) => state.analytics.optedOut,
/**
* Show or hide all UI compontent related to analytics.
* @param {State} state
*/
selectShowAnalyticsComponents: (state) => state.analytics.showAnalyticsComponents,
/**
* Show or hide the analytics banner.
* @param {State} state
Expand Down Expand Up @@ -442,8 +453,9 @@ const createAnalyticsBundle = ({
state = state || {
lastEnabledAt: 0,
lastDisabledAt: 0,
showAnalyticsComponents: DISABLE_ALL_ANALYTICS, // hide related UI for now, see https://github.com/ipfs/ipfs-webui/issues/2198
showAnalyticsBanner: false,
optedOut: false,
optedOut: !DISABLE_ALL_ANALYTICS, // disable analytics by default for now, see https://github.com/ipfs/ipfs-webui/issues/2198
consent: []
}

Expand Down
14 changes: 9 additions & 5 deletions src/settings/SettingsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const SettingsPage = ({
isLoading, isSaving, arePinningServicesSupported,
hasSaveFailed, hasSaveSucceded, hasErrors, hasLocalChanges, hasExternalChanges,
config, onChange, onReset, onSave, editorKey, analyticsEnabled, doToggleAnalytics,
showAnalyticsComponents,
toursEnabled, handleJoyrideCallback, isCliTutorModeEnabled, doToggleCliTutorMode, command
}) => (
<div data-id='SettingsPage' className='mw9 center'>
Expand Down Expand Up @@ -92,15 +93,17 @@ export const SettingsPage = ({
</Box>

<Box className='mb3 pa4-l pa2'>
<div className='mb4 joyride-settings-language'>
<div className='joyride-settings-language'>
<Title>{t('language')}</Title>
<LanguageSelector t={t} />
</div>

<div className='joyride-settings-analytics'>
<Title>{t('analytics')}</Title>
<AnalyticsToggle t={t} doToggleAnalytics={doToggleAnalytics} analyticsEnabled={analyticsEnabled} />
</div>
{ showAnalyticsComponents
? <div className='mt4 joyride-settings-analytics'>

Check warning on line 102 in src/settings/SettingsPage.js

View check run for this annotation

Codecov / codecov/patch

src/settings/SettingsPage.js#L102

Added line #L102 was not covered by tests
<Title>{t('analytics')}</Title>
<AnalyticsToggle t={t} doToggleAnalytics={doToggleAnalytics} analyticsEnabled={analyticsEnabled} />
</div>
: null }
</Box>

<Experiments t={t} />
Expand Down Expand Up @@ -376,6 +379,7 @@ export default connect(
'selectConfigSaveLastError',
'selectIsIpfsDesktop',
'selectToursEnabled',
'selectShowAnalyticsComponents',
'selectAnalyticsEnabled',
'selectArePinningServicesSupported',
'doToggleAnalytics',
Expand Down
4 changes: 3 additions & 1 deletion src/status/StatusPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import withTour from '../components/tour/withTour.js'
const StatusPage = ({
t,
ipfsConnected,
showAnalyticsComponents,
showAnalyticsBanner,
doEnableAnalytics,
doDisableAnalytics,
Expand Down Expand Up @@ -53,7 +54,7 @@ const StatusPage = ({
</div>
</div>
</Box>
{ ipfsConnected && showAnalyticsBanner &&
{ ipfsConnected && showAnalyticsComponents && showAnalyticsBanner &&
<AnalyticsBanner
className='mt3'
label={t('AnalyticsBanner.label')}
Expand Down Expand Up @@ -92,6 +93,7 @@ export default connect(
'selectIpfsConnected',
'selectNodeBandwidthEnabled',
'selectShowAnalyticsBanner',
'selectShowAnalyticsComponents',
'selectToursEnabled',
'doEnableAnalytics',
'doDisableAnalytics',
Expand Down

0 comments on commit 77fcafb

Please sign in to comment.