2
2
* Telemetry and analytics module.
3
3
* This module abstracts the exact service/framework used for tracking usage.
4
4
*/
5
- import { get } from 'lodash'
6
5
import isGlob from 'is-glob'
7
6
import * as jsonpath from 'jsonpath'
8
7
import { Nullable } from 'uiSrc/utils'
9
- import store from 'uiSrc/slices/store'
10
8
import { localStorageService } from 'uiSrc/services'
11
9
import { ApiEndpoints , BrowserStorageItem , KeyTypes } from 'uiSrc/constants'
12
10
import { KeyViewType } from 'uiSrc/slices/interfaces/keys'
11
+ import { checkIsAnalyticsGranted } from 'uiSrc/telemetry/checkAnalytics'
13
12
import { ITelemetrySendEvent , ITelemetrySendPageView , ITelemetryService , MatchType } from './interfaces'
14
13
import { TelemetryEvent } from './events'
15
14
import { NON_TRACKING_ANONYMOUS_ID , SegmentTelemetryService } from './segment'
@@ -29,10 +28,6 @@ const getTelemetryService = (apiKey: string): ITelemetryService => {
29
28
return telemetryService
30
29
}
31
30
32
- // Check is user give access to collect his events
33
- const checkIsAnalyticsGranted = ( ) =>
34
- ! ! get ( store . getState ( ) , 'user.settings.config.agreements.analytics' , false )
35
-
36
31
// Telemetry doesn't watch on sending anonymousId like arg of function. Only look at localStorage
37
32
const setAnonymousId = ( isAnalyticsGranted : boolean ) => {
38
33
const anonymousId = isAnalyticsGranted
0 commit comments