Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
fe09402
chore: Make segment singleton
hetunandu Dec 11, 2024
8d28d95
fix: type error
hetunandu Dec 11, 2024
c193689
Merge branch 'release' into chore/analytics-util-refactor
hetunandu Dec 11, 2024
3795506
chore: correct split for logEvent
hetunandu Dec 11, 2024
e9090d2
Merge branch 'release' into chore/analytics-util-refactor
hetunandu Dec 11, 2024
d62d1c1
chore: correct split for identifyUser
hetunandu Dec 11, 2024
c7b34a6
fix type error
hetunandu Dec 11, 2024
8f6216d
chore: remove zipy
hetunandu Dec 11, 2024
0dc6a20
chore: Other changes to separate concerns
hetunandu Dec 12, 2024
a5fe8de
Merge branch 'release' into chore/analytics-util-refactor
hetunandu Dec 12, 2024
9a59649
fix: user source getter
hetunandu Dec 12, 2024
11034ef
Merge branch 'release' into chore/analytics-util-refactor
hetunandu Dec 12, 2024
0ef89c7
fix: TrackedUser error handling
hetunandu Dec 12, 2024
7009e5d
chore: Mask all mixpanel recordings
hetunandu Dec 13, 2024
be6a625
chore: Mixpanel should not record admin settings
hetunandu Dec 13, 2024
713cf05
chore: Improve segment anonymousId get
hetunandu Dec 13, 2024
74a1ddd
chore: AnalyticsUtil.tsx improvements
hetunandu Dec 13, 2024
a383ef3
remove other ee concerns from ce
hetunandu Dec 13, 2024
e3f8768
chore: null checks
hetunandu Dec 13, 2024
61986b2
Revert "chore: AnalyticsUtil.tsx improvements"
hetunandu Dec 13, 2024
08a0d40
chore: Fix Smartlook init
hetunandu Dec 16, 2024
864a829
Merge branch 'release' into chore/analytics-util-refactor
hetunandu Dec 16, 2024
caca6fd
chore: convert class into object
hetunandu Dec 16, 2024
6cd44a9
chore: export getEventExtraProperties
hetunandu Dec 16, 2024
cbbcc1a
verify theory
hetunandu Dec 16, 2024
0bf6f87
chore: add cypress logging
hetunandu Dec 16, 2024
1c1da03
chore: add back editor line
hetunandu Dec 16, 2024
2549d3c
Revert "chore: add cypress logging"
hetunandu Dec 16, 2024
a9c3d68
chore: segment init change
hetunandu Dec 17, 2024
949076c
chore: Try toasts
hetunandu Dec 17, 2024
250121f
avoid waiting for segment init
hetunandu Dec 17, 2024
de8acdd
Merge branch 'release' into chore/analytics-util-refactor
hetunandu Dec 17, 2024
0730a4e
chore: Better splitting
hetunandu Dec 17, 2024
fb643f5
chore: check if its the state issue
hetunandu Dec 17, 2024
719dd1e
Merge branch 'release' into chore/analytics-util-refactor
hetunandu Dec 17, 2024
071b86b
fix: Type error from latest changes
hetunandu Dec 17, 2024
414657d
Merge branch 'release' into chore/analytics-util-refactor
hetunandu Dec 18, 2024
34a639a
fix: chore test another change
hetunandu Dec 18, 2024
a79138a
chore: Updte tracked user usage
hetunandu Dec 18, 2024
25ac6ce
chore: Revert wait added in pull #19122
hetunandu Dec 18, 2024
aebbbd4
chore: Avoid adding more dependencies
hetunandu Dec 18, 2024
87d3493
Merge branch 'release' into chore/analytics-util-refactor
hetunandu Dec 19, 2024
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
1 change: 1 addition & 0 deletions app/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
"@redux-saga/core": "1.1.3",
"@redux-saga/types": "1.2.1",
"@reduxjs/toolkit": "^2.4.0",
"@segment/analytics-next": "^1.76.0",
"@sentry/react": "^6.2.4",
"@shared/ast": "workspace:^",
"@shared/dsl": "workspace:^",
Expand Down
16 changes: 0 additions & 16 deletions app/client/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
return result;
};
const CLOUD_HOSTING = parseConfig('{{env "APPSMITH_CLOUD_HOSTING"}}');
const ZIPY_KEY = parseConfig('{{env "APPSMITH_ZIPY_SDK_KEY"}}');
const AIRGAPPED = parseConfig('{{env "APPSMITH_AIRGAP_ENABLED"}}');
const REO_CLIENT_ID = parseConfig('{{env "APPSMITH_REO_CLIENT_ID"}}');
</script>
Expand All @@ -64,21 +63,6 @@
})()
%>
</script>
<script>
if (CLOUD_HOSTING && ZIPY_KEY) {
const script = document.createElement("script");
script.crossOrigin = "anonymous";
script.defer = true;
script.src = "https://cdn.zipy.ai/sdk/v1.0/zipy.min.umd.js";
script.onload = () => {
window.zipy && window.zipy.init(ZIPY_KEY);
};
const head = document.getElementsByTagName("head")[0];
head && head.appendChild(script);
}


</script>

<!-- Start of Reo Javascript -->
<script type="text/javascript">
Expand Down
9 changes: 0 additions & 9 deletions app/client/src/actions/analyticsActions.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { InternalAxiosRequestConfig } from "axios";
import type { ID } from "@segment/analytics-next";

export const addAnonymousUserIdHeader = (
config: InternalAxiosRequestConfig,
options: { anonymousId?: string; segmentEnabled?: boolean },
options: { anonymousId: ID; segmentEnabled?: boolean },
) => {
const { anonymousId, segmentEnabled } = options;

Expand Down
2 changes: 0 additions & 2 deletions app/client/src/ce/constants/ReduxActionConstants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1214,8 +1214,6 @@ const TenantActionErrorTypes = {
};

const AnalyticsActionTypes = {
SEGMENT_INITIALIZED: "SEGMENT_INITIALIZED",
SEGMENT_INIT_UNCERTAIN: "SEGMENT_INIT_UNCERTAIN",
SET_BUILDING_BLOCK_DRAG_START_TIME: "SET_BUILDING_BLOCK_DRAG_START_TIME",
RESET_BUILDING_BLOCK_DRAG_START_TIME: "RESET_BUILDING_BLOCK_DRAG_START_TIME",
SEND_ANALYTICS_FOR_SIDE_BY_SIDE_HOVER:
Expand Down
2 changes: 0 additions & 2 deletions app/client/src/ce/reducers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ import type { CanvasLevelsReduxState } from "reducers/entityReducers/autoHeightR
import type { LintErrorsStore } from "reducers/lintingReducers/lintErrorsReducers";
import lintErrorReducer from "reducers/lintingReducers";
import type { AutoHeightUIState } from "reducers/uiReducers/autoHeightReducer";
import type { AnalyticsReduxState } from "reducers/uiReducers/analyticsReducer";
import type { MetaWidgetsReduxState } from "reducers/entityReducers/metaWidgetsReducer";
import type { layoutConversionReduxState } from "reducers/uiReducers/layoutConversionReducer";
import type { OneClickBindingState } from "reducers/uiReducers/oneClickBindingReducer";
Expand Down Expand Up @@ -92,7 +91,6 @@ export const reducerObject = {
export interface AppState {
ui: {
consolidatedPageLoad: ConsolidatedPageLoadState;
analytics: AnalyticsReduxState;
editor: EditorReduxState;
propertyPane: PropertyPaneReduxState;
tableFilterPane: TableFilterPaneReduxState;
Expand Down
2 changes: 0 additions & 2 deletions app/client/src/ce/reducers/uiReducers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import { editorContextReducer } from "ee/reducers/uiReducers/editorContextReduce
import libraryReducer from "reducers/uiReducers/libraryReducer";
import appSettingsPaneReducer from "reducers/uiReducers/appSettingsPaneReducer";
import autoHeightUIReducer from "reducers/uiReducers/autoHeightReducer";
import analyticsReducer from "reducers/uiReducers/analyticsReducer";
import layoutConversionReducer from "reducers/uiReducers/layoutConversionReducer";
import oneClickBindingReducer from "reducers/uiReducers/oneClickBindingReducer";
import activeFieldReducer from "reducers/uiReducers/activeFieldEditorReducer";
Expand All @@ -49,7 +48,6 @@ import consolidatedPageLoadReducer from "reducers/uiReducers/consolidatedPageLoa
import { pluginActionReducer } from "PluginActionEditor/store";

export const uiReducerObject = {
analytics: analyticsReducer,
editor: editorReducer,
errors: errorReducer,
propertyPane: propertyPaneReducer,
Expand Down
35 changes: 6 additions & 29 deletions app/client/src/ce/sagas/analyticsSaga.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { getCurrentUser } from "selectors/usersSelectors";
import { getInstanceId } from "ee/selectors/tenantSelectors";
import { call, select } from "redux-saga/effects";
import type { APP_MODE } from "entities/App";
Expand All @@ -10,44 +9,37 @@ import AnalyticsUtil from "ee/utils/AnalyticsUtil";
import { getAppMode } from "ee/selectors/entitiesSelector";
import type { AppState } from "ee/reducers";
import { getWidget } from "sagas/selectors";
import { getUserSource } from "ee/utils/AnalyticsUtil";
import { getCurrentApplication } from "ee/selectors/applicationSelectors";

export interface UserAndAppDetails {
export interface AppDetails {
pageId: string;
appId: string;
appMode: APP_MODE | undefined;
appName: string;
isExampleApp: boolean;
userId: string;
email: string;
source: string;
instanceId: string;
}

export function* getUserAndAppDetails() {
export function* getAppDetails() {
const appMode: ReturnType<typeof getAppMode> = yield select(getAppMode);
const currentApp: ReturnType<typeof getCurrentApplication> = yield select(
getCurrentApplication,
);
const user: ReturnType<typeof getCurrentUser> = yield select(getCurrentUser);
const instanceId: ReturnType<typeof getInstanceId> =
yield select(getInstanceId);
const pageId: ReturnType<typeof getCurrentPageId> =
yield select(getCurrentPageId);
const userAndAppDetails: UserAndAppDetails = {

const appDetails: AppDetails = {
pageId,
appId: currentApp?.id || "",
appMode,
appName: currentApp?.name || "",
isExampleApp: currentApp?.appIsExample || false,
userId: user?.username || "",
email: user?.email || "",
source: getUserSource(),
instanceId: instanceId,
};

return userAndAppDetails;
return appDetails;
}
export function* logDynamicTriggerExecution({
dynamicTrigger,
Expand All @@ -65,13 +57,10 @@ export function* logDynamicTriggerExecution({
appId,
appMode,
appName,
email,
instanceId,
isExampleApp,
pageId,
source,
userId,
}: UserAndAppDetails = yield call(getUserAndAppDetails);
}: AppDetails = yield call(getAppDetails);
const widget: ReturnType<typeof getWidget> | undefined = yield select(
(state: AppState) => getWidget(state, triggerMeta.source?.id || ""),
);
Expand All @@ -89,12 +78,6 @@ export function* logDynamicTriggerExecution({
appMode,
appName,
isExampleApp,
userData: {
userId,
email,
appId,
source,
},
widgetName: widget?.widgetName,
widgetType: widget?.type,
propertyName: triggerMeta.triggerPropertyName,
Expand All @@ -114,12 +97,6 @@ export function* logDynamicTriggerExecution({
appMode,
appName,
isExampleApp,
userData: {
userId,
email,
appId,
source,
},
widgetName: widget?.widgetName,
widgetType: widget?.type,
propertyName: triggerMeta.triggerPropertyName,
Expand Down
40 changes: 5 additions & 35 deletions app/client/src/ce/sagas/userSagas.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { call, fork, put, race, select, take } from "redux-saga/effects";
import { call, fork, put, select, take } from "redux-saga/effects";
import type {
ReduxAction,
ReduxActionWithPromise,
Expand Down Expand Up @@ -57,14 +57,7 @@ import {
getFirstTimeUserOnboardingApplicationIds,
getFirstTimeUserOnboardingIntroModalVisibility,
} from "utils/storage";
import { initializeAnalyticsAndTrackers } from "utils/AppsmithUtils";
import { getAppsmithConfigs } from "ee/configs";
import { getSegmentState } from "selectors/analyticsSelectors";
import {
segmentInitUncertain,
segmentInitSuccess,
} from "actions/analyticsActions";
import type { SegmentState } from "reducers/uiReducers/analyticsReducer";
import type { FeatureFlags } from "ee/entities/FeatureFlag";
import { DEFAULT_FEATURE_FLAG_VALUE } from "ee/entities/FeatureFlag";
import UsagePulse from "usagePulse";
Expand All @@ -82,25 +75,6 @@ import type {
import { selectFeatureFlags } from "ee/selectors/featureFlagsSelectors";
import { getFromServerWhenNoPrefetchedResult } from "sagas/helper";

export function* waitForSegmentInit(skipWithAnonymousId: boolean) {
if (skipWithAnonymousId && AnalyticsUtil.getAnonymousId()) return;

const currentUser: User | undefined = yield select(getCurrentUser);
const segmentState: SegmentState | undefined = yield select(getSegmentState);
const appsmithConfig = getAppsmithConfigs();

if (
currentUser?.enableTelemetry &&
appsmithConfig.segment.enabled &&
!segmentState
) {
yield race([
take(ReduxActionTypes.SEGMENT_INITIALIZED),
take(ReduxActionTypes.SEGMENT_INIT_UNCERTAIN),
]);
}
}

export function* getCurrentUserSaga(action?: {
payload?: { userProfile?: ApiResponse };
}) {
Expand Down Expand Up @@ -134,14 +108,10 @@ export function* getCurrentUserSaga(action?: {
}

function* initTrackers(currentUser: User) {
const initializeSentry = initializeAnalyticsAndTrackers(currentUser);

const sentryInitialized: boolean = yield initializeSentry;

if (sentryInitialized) {
yield put(segmentInitSuccess());
} else {
yield put(segmentInitUncertain());
try {
yield call(AnalyticsUtil.initialize, currentUser);
} catch (e) {
log.error(e);
}
}

Expand Down
36 changes: 36 additions & 0 deletions app/client/src/ce/utils/Analytics/getEventExtraProperties.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { getAppsmithConfigs } from "ee/configs";
import TrackedUser from "ee/utils/Analytics/trackedUser";
import { noop } from "lodash";

let instanceId = "";

function initLicense() {
return noop();
}

function initInstanceId(id: string) {
instanceId = id;
}

function getInstanceId() {
return instanceId;
}

function getEventExtraProperties() {
const { appVersion } = getAppsmithConfigs();
let userData;

try {
userData = TrackedUser.getInstance().getUser();
} catch (e) {
userData = {};
}

return {
instanceId,
version: appVersion.id,
userData,
};
}

export { getEventExtraProperties, initInstanceId, getInstanceId, initLicense };
Loading