fix: analytic events added for start with data flow (#29463)

## Description

This PR:
- Adds analytic events for start with data onboarding flow, List of
events and their details can be found in this
[doc](https://www.notion.so/appsmith/Analytic-Events-c326270138c046f4b29328bc18b89b2d)
- There was an issue in DATASOURCE_SCHEMA_FETCH event, it was throwing
misleading information when the datasource structure fetch API failed,
that issue has been fixed as well

#### PR fixes following issue(s)
Fixes #29435 
#### Media
> A video or a GIF is preferred. when using Loom, don’t embed because it
looks like it’s a GIF. instead, just link to the video
>
>
#### Type of change
- Chore (housekeeping or task changes that don't impact user perception)
>
>
>
## Testing
>
#### How Has This Been Tested?
> Please describe the tests that you ran to verify your changes. Also
list any relevant details for your test configuration.
> Delete anything that is not relevant
- [x] Manual
- [ ] JUnit
- [ ] Jest
- [ ] Cypress
>
>
#### Test Plan
> Add Testsmith test cases links that relate to this PR
>
>
#### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
>
>
>
## Checklist:
#### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [x] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Enhanced analytics tracking for user interactions during the
onboarding process, including skipping steps.

- **Refactor**
- Improved internal logic for fetching and refreshing datasource
structures to enhance error handling and success tracking.

- **Documentation**
- Updated type definitions to reflect new analytics events related to
the onboarding flow.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: “sneha122” <“sneha@appsmith.com”>
This commit is contained in:
sneha122 2023-12-08 15:26:57 +05:30 committed by GitHub
parent 7d7774760d
commit 43474fcfa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 5 deletions

View File

@ -235,6 +235,7 @@ const CreateNewAppsOption = ({
);
if (devEnabled) {
// fetch plugins information to show list of all plugins
AnalyticsUtil.logEvent("CREATE_APP_FROM_DATA");
dispatch(fetchPlugins());
dispatch(fetchMockDatasources());
if (application?.workspaceId) {
@ -291,6 +292,35 @@ const CreateNewAppsOption = ({
}
};
const addAnalyticEventsForSkip = () => {
if (useType === START_WITH_TYPE.TEMPLATE) {
if (selectedTemplate) {
const template = getTemplateById(selectedTemplate);
if (template) {
AnalyticsUtil.logEvent(
"ONBOARDING_FLOW_CLICK_SKIP_BUTTON_TEMPLATE_DETAILS_PAGE",
{ title: template.title },
);
}
} else {
AnalyticsUtil.logEvent(
"ONBOARDING_FLOW_CLICK_SKIP_BUTTON_START_FROM_TEMPLATE_PAGE",
);
}
} else if (useType === START_WITH_TYPE.DATA) {
if (createNewAppPluginId) {
AnalyticsUtil.logEvent(
"ONBOARDING_FLOW_CLICK_SKIP_BUTTON_DATASOURCE_FORM_PAGE",
{ pluginId: createNewAppPluginId },
);
} else {
AnalyticsUtil.logEvent(
"ONBOARDING_FLOW_CLICK_SKIP_BUTTON_START_FROM_DATA_PAGE",
);
}
}
};
const onClickSkipButton = () => {
if (application) {
urlBuilder.updateURLParams(
@ -312,9 +342,7 @@ const CreateNewAppsOption = ({
);
}
AnalyticsUtil.logEvent("START_FROM_TEMPLATES_CLICK_SKIP_BUTTON", {
startWithType: useType,
});
addAnalyticEventsForSkip();
};
const onClickBackButton = () => {

View File

@ -363,7 +363,11 @@ export type ONBOARDING_FLOW_EVENTS =
| "ONBOARDING_FLOW_CLICK_BACK_BUTTON_START_FROM_DATA_PAGE"
| "ONBOARDING_FLOW_CLICK_BACK_BUTTON_DATASOURCE_FORM_PAGE"
| "ONBOARDING_FLOW_DATASOURCE_FORM_CANCEL_CLICK"
| "CREATE_APP_FROM_DATA";
| "CREATE_APP_FROM_DATA"
| "ONBOARDING_FLOW_CLICK_SKIP_BUTTON_START_FROM_DATA_PAGE"
| "ONBOARDING_FLOW_CLICK_SKIP_BUTTON_DATASOURCE_FORM_PAGE"
| "ONBOARDING_FLOW_CLICK_SKIP_BUTTON_START_FROM_TEMPLATE_PAGE"
| "ONBOARDING_FLOW_CLICK_SKIP_BUTTON_TEMPLATE_DETAILS_PAGE";
export type DATASOURCE_SCHEMA_EVENTS =
| "DATASOURCE_SCHEMA_SEARCH"

View File

@ -1411,11 +1411,13 @@ function* fetchDatasourceStructureSaga(
});
}
if (!!(response.data as any)?.error) {
isSuccess = false;
errorMessage = (response.data as any).error?.message;
}
}
} catch (error) {
errorMessage = (error as any)?.message;
isSuccess = false;
yield put({
type: ReduxActionErrorTypes.FETCH_DATASOURCE_STRUCTURE_ERROR,
payload: {
@ -1528,10 +1530,12 @@ function* refreshDatasourceStructure(
});
}
if (!!(response.data as any)?.error) {
errorMessage = (response.data as any)?.message;
isSuccess = false;
errorMessage = (response.data as any)?.error?.message;
}
}
} catch (error) {
isSuccess = false;
errorMessage = (error as any)?.message;
yield put({
type: ReduxActionErrorTypes.REFRESH_DATASOURCE_STRUCTURE_ERROR,