Fix - #6221 new nav analytics improvements (#6223)

* fixed redirection on connect data click. and updated analytics

* Added generic analytics for all datasource cards
This commit is contained in:
Pranav Kanade 2021-07-30 11:17:38 +05:30 committed by GitHub
parent fbf6d9ad2d
commit e08b748b02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 8 deletions

View File

@ -8,6 +8,7 @@ import { addMockDatasourceToOrg } from "actions/datasourceActions";
import { getCurrentOrgId } from "selectors/organizationSelectors";
import { getQueryParams } from "../../../utils/AppsmithUtils";
import { AppState } from "../../../reducers";
import AnalyticsUtil from "../../../utils/AnalyticsUtil";
const MockDataSourceWrapper = styled.div`
overflow: auto;
@ -105,6 +106,10 @@ function MockDatasourceCard(props: MockDatasourceCardProps) {
}
const addMockDataSource = () => {
AnalyticsUtil.logEvent("CREATE_DATA_SOURCE_CLICK", {
mockDatasourceName: datasource.name,
plugin: currentPlugin,
});
const queryParams = getQueryParams();
dispatch(
addMockDatasourceToOrg(

View File

@ -173,6 +173,9 @@ function NewApiScreen(props: Props) {
AnalyticsUtil.logEvent("CREATE_DATA_SOURCE_AUTH_API_CLICK", {
pluginId: authApiPlugin.id,
});
AnalyticsUtil.logEvent("CREATE_DATA_SOURCE_CLICK", {
plugin: authApiPlugin,
});
props.createDatasourceFromForm({
pluginId: authApiPlugin.id,
});
@ -180,6 +183,9 @@ function NewApiScreen(props: Props) {
}, [authApiPlugin, props.createDatasourceFromForm]);
const handleCreateNew = () => {
AnalyticsUtil.logEvent("CREATE_DATA_SOURCE_CLICK", {
source: "CREATE_NEW_API",
});
if (pageId) {
createNewApiAction(pageId, "API_PANE");
}
@ -211,6 +217,9 @@ function NewApiScreen(props: Props) {
AnalyticsUtil.logEvent("IMPORT_API_CLICK", {
importSource: CURL,
});
AnalyticsUtil.logEvent("CREATE_DATA_SOURCE_CLICK", {
source: CURL,
});
delete queryParams.isGeneratePageMode;
const curlImportURL =
@ -289,11 +298,14 @@ function NewApiScreen(props: Props) {
<ApiCard
className={`t--createBlankApi-${p.packageName}`}
key={p.id}
onClick={() =>
onClick={() => {
AnalyticsUtil.logEvent("CREATE_DATA_SOURCE_CLICK", {
plugin: p,
});
handleOnClick(API_ACTION.CREATE_DATASOURCE_FORM, {
pluginId: p.id,
})
}
});
}}
>
<CardContentWrapper>
<div className="content-icon-wrapper">

View File

@ -19,7 +19,7 @@ import {
} from "actions/globalSearchActions";
import AnalyticsUtil from "utils/AnalyticsUtil";
import { getTypographyByKey } from "constants/DefaultTheme";
import { WidgetTypes } from "constants/WidgetConstants";
import { WidgetType, WidgetTypes } from "constants/WidgetConstants";
const StyledDiv = styled.div`
color: ${(props) => props.theme.colors.propertyPane.ctaTextColor};
@ -63,7 +63,13 @@ export const excludeList = [
export const actionsExist = (state: AppState): boolean =>
!!state.entities.actions.length;
function ConnectDataCTA() {
type ConnectDataCTAProps = {
widgetTitle: string;
widgetId?: string;
widgetType?: WidgetType;
};
function ConnectDataCTA(props: ConnectDataCTAProps) {
const applicationId = useSelector(getCurrentApplicationId);
const pageId = useSelector(getCurrentPageId);
const dispatch = useDispatch();
@ -77,15 +83,20 @@ function ConnectDataCTA() {
}, []);
const onClick = () => {
const { widgetId, widgetTitle, widgetType } = props;
history.push(
INTEGRATION_EDITOR_URL(
applicationId,
pageId,
INTEGRATION_TABS.NEW,
INTEGRATION_EDITOR_MODES.MOCK,
INTEGRATION_EDITOR_MODES.AUTO,
),
);
AnalyticsUtil.logEvent("CONNECT_DATA_CLICK");
AnalyticsUtil.logEvent("CONNECT_DATA_CLICK", {
widgetTitle,
widgetId,
widgetType,
});
};
return (

View File

@ -184,7 +184,13 @@ function PropertyPaneView(
widgetType={widgetProperties?.type}
/>
<PropertyPaneBodyWrapper>
{!doActionsExist && !hideConnectDataCTA && <ConnectDataCTA />}
{!doActionsExist && !hideConnectDataCTA && (
<ConnectDataCTA
widgetId={widgetProperties.widgetId}
widgetTitle={widgetProperties.widgetName}
widgetType={widgetProperties?.type}
/>
)}
<PropertyControlsWrapper>
<PropertyControlsGenerator
id={widgetProperties.widgetId}