diff --git a/app/client/src/api/ActionAPI.tsx b/app/client/src/api/ActionAPI.tsx index 11c353a6ad..3aac744840 100644 --- a/app/client/src/api/ActionAPI.tsx +++ b/app/client/src/api/ActionAPI.tsx @@ -56,6 +56,7 @@ export interface ExecuteActionRequest extends APIRequest { | Record | Record>> >; + analyticsProperties?: Record; } export type ExecuteActionResponse = ApiResponse & { diff --git a/app/client/src/sagas/ActionExecution/PluginActionSaga.ts b/app/client/src/sagas/ActionExecution/PluginActionSaga.ts index f1349a936c..90bc6b33a6 100644 --- a/app/client/src/sagas/ActionExecution/PluginActionSaga.ts +++ b/app/client/src/sagas/ActionExecution/PluginActionSaga.ts @@ -716,6 +716,8 @@ function* runActionSaga( executePluginActionSaga, id, paginationField, + {}, + true, ); payload = executePluginActionResponse.payload; isError = executePluginActionResponse.isError; @@ -1100,6 +1102,7 @@ function* executePluginActionSaga( actionOrActionId: PageAction | string, paginationField?: PaginationField, params?: Record, + isUserInitiated?: boolean, ) { let pluginAction; let actionId; @@ -1151,6 +1154,9 @@ function* executePluginActionSaga( actionId: actionId, viewMode: appMode === APP_MODE.PUBLISHED, paramProperties: {}, + analyticsProperties: { + isUserInitiated: !!isUserInitiated, + }, }; if (paginationField) { diff --git a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/dtos/ExecuteActionDTO.java b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/dtos/ExecuteActionDTO.java index 7cb3873eff..7890daa087 100644 --- a/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/dtos/ExecuteActionDTO.java +++ b/app/server/appsmith-interfaces/src/main/java/com/appsmith/external/dtos/ExecuteActionDTO.java @@ -41,6 +41,8 @@ public class ExecuteActionDTO { Map invertParameterMap; // e.g. {"k1":"Text1.text","k2":"Table1.data", "k3": "Api1.data"} + Map analyticsProperties; + @JsonIgnore long totalReadableByteCount; diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImpl.java index c47ffec66b..a7ab2e8b14 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCEImpl.java @@ -308,6 +308,7 @@ public class ActionExecutionSolutionCEImpl implements ActionExecutionSolutionCE dto.setViewMode(executeActionDTO.getViewMode()); dto.setParamProperties(executeActionDTO.getParamProperties()); dto.setPaginationField(executeActionDTO.getPaginationField()); + dto.setAnalyticsProperties(executeActionDTO.getAnalyticsProperties()); return Mono.empty(); }); } @@ -1043,6 +1044,10 @@ public class ActionExecutionSolutionCEImpl implements ActionExecutionSolutionCE paramsList = new ArrayList<>(); } List executionParams = paramsList.stream().map(param -> param.getValue()).collect(Collectors.toList()); + Map analyticsProperties = executeActionDto.getAnalyticsProperties(); + if (analyticsProperties == null) { + analyticsProperties = new HashMap<>(); + } data.putAll(Map.of( "request", request, @@ -1052,7 +1057,8 @@ public class ActionExecutionSolutionCEImpl implements ActionExecutionSolutionCE "statusCode", ObjectUtils.defaultIfNull(actionExecutionResult.getStatusCode(), ""), "timeElapsed", timeElapsed, "actionCreated", DateUtils.ISO_FORMATTER.format(action.getCreatedAt()), - "actionId", ObjectUtils.defaultIfNull(action.getId(), "") + "actionId", ObjectUtils.defaultIfNull(action.getId(), ""), + "isUserInitiated", ObjectUtils.defaultIfNull(analyticsProperties.get("isUserInitiated"), false) )); data.putAll(Map.of( FieldName.ACTION_EXECUTION_REQUEST_PARAMS_SIZE, executeActionDto.getTotalReadableByteCount(),