Skip to content

Commit 1e04f2e

Browse files
committed
fix(analytics): opt-out and hide ui components
https://github.com/ipfs/ipfs-webui/pull/2216/files#r1556085374
1 parent 77fcafb commit 1e04f2e

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/bundles/analytics.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,9 +453,9 @@ const createAnalyticsBundle = ({
453453
state = state || {
454454
lastEnabledAt: 0,
455455
lastDisabledAt: 0,
456-
showAnalyticsComponents: DISABLE_ALL_ANALYTICS, // hide related UI for now, see https://github.com/ipfs/ipfs-webui/issues/2198
456+
showAnalyticsComponents: !DISABLE_ALL_ANALYTICS, // hide related UI for now, see https://github.com/ipfs/ipfs-webui/issues/2198
457457
showAnalyticsBanner: false,
458-
optedOut: !DISABLE_ALL_ANALYTICS, // disable analytics by default for now, see https://github.com/ipfs/ipfs-webui/issues/2198
458+
optedOut: DISABLE_ALL_ANALYTICS, // disable analytics by default for now, see https://github.com/ipfs/ipfs-webui/issues/2198
459459
consent: []
460460
}
461461

src/bundles/analytics.test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,25 @@ function createStore (analyticsOpts = {}, mockAnalyticsCachedState) {
3535
}
3636

3737
describe('new/returning user default behavior', () => {
38+
// 2024-Q2: disabling and hiding all metrics for now
39+
// https://github.com/ipfs/ipfs-webui/pull/2216
40+
it('should disable analytics by default and hide all UI compontents', () => {
41+
const store = createStore()
42+
expect(store.selectAnalyticsEnabled()).toBe(false)
43+
expect(store.selectShowAnalyticsComponents()).toBe(false)
44+
expect(store.selectAnalyticsConsent()).toEqual([])
45+
expect(global.Countly.opt_in).not.toHaveBeenCalled()
46+
expect(global.Countly.opt_out).not.toHaveBeenCalled()
47+
})
48+
/*
3849
it('should enable analytics by default for new user who has not opted in or out', () => {
3950
const store = createStore()
4051
expect(global.Countly.opt_in).toHaveBeenCalled()
4152
expect(global.Countly.opt_in.mock.calls.length).toBe(1)
4253
// events will be sent as consents have been given by default
4354
expect(store.selectAnalyticsConsent()).toEqual(['sessions', 'events', 'views', 'location'])
4455
})
56+
*/
4557
it('should enable existing analytics by default for returning user who was opted_in', () => {
4658
const mockDefaultState = {
4759
lastEnabledAt: (new Date('2022-01-02')).getTime(),

0 commit comments

Comments
 (0)