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

chore: disable countly analytics and hide unused UI #2216

Merged
merged 2 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
optedOut: !DISABLE_ALL_ANALYTICS, // disable analytics by default for now, see https://github.com/ipfs/ipfs-webui/issues/2198
optedOut: DISABLE_ALL_ANALYTICS, // disable analytics by default for now, see https://github.com/ipfs/ipfs-webui/issues/2198

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't we want to set this opted out to true for now? if not, we should probably leave as false

Copy link
Member Author

@lidel lidel Apr 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch – my bad, I negated the wrong line. Fixed in 1e04f2e + updated tests to confirm we hide UI and do no tracking by default.

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 @@
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 @@
</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 @@
'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
Loading