More analytics and added analytics for groups

Summary: Adds analytics for the selected group, failure cases and distinguishing between user clicks for the support form vs deeplink.

Reviewed By: passy

Differential Revision: D19697856

fbshipit-source-id: 62d5afa998d2096252570387c9a3df1c7c134e67
This commit is contained in:
Pritesh Nandgaonkar
2020-02-04 06:23:27 -08:00
committed by Facebook Github Bot
parent e48966f529
commit 76bf84cb20
2 changed files with 44 additions and 6 deletions

View File

@@ -28,11 +28,14 @@ import {
PluginName,
ListItem,
} from './sidebarUtils';
import {Group} from '../../reducers/supportForm';
import {getInstance} from '../../fb-stubs/Logger';
type OwnProps = {};
type StateFromProps = {
staticView: StaticView;
selectedGroup: Group;
};
type DispatchFromProps = {
@@ -44,6 +47,7 @@ type Props = OwnProps & StateFromProps & DispatchFromProps;
function MainSidebarUtilsSection({
staticView,
selectedGroup,
setActiveSheet,
setStaticView,
}: Props) {
@@ -86,7 +90,13 @@ function MainSidebarUtilsSection({
return (
<ListItem
active={active}
onClick={() => setStaticView(SupportRequestFormV2)}>
onClick={() => {
getInstance().track('usage', 'support-form-source', {
source: 'sidebar',
group: selectedGroup.name,
});
setStaticView(SupportRequestFormV2);
}}>
<PluginIcon
color={colors.light50}
name={'app-dailies'}
@@ -112,8 +122,9 @@ function MainSidebarUtilsSection({
}
export default connect<StateFromProps, DispatchFromProps, OwnProps, Store>(
({connections: {staticView}}) => ({
({connections: {staticView}, supportForm: {supportFormV2}}) => ({
staticView,
selectedGroup: supportFormV2.selectedGroup,
}),
{
setStaticView,

View File

@@ -17,6 +17,11 @@ import {selectedPlugins as setSelectedPlugins} from './plugins';
import {getEnabledOrExportPersistedStatePlugins} from '../utils/pluginUtils';
import {addStatusMessage, removeStatusMessage} from './application';
import constants from '../fb-stubs/constants';
import {getInstance} from '../fb-stubs/Logger';
import {logPlatformSuccessRate} from '../utils/metrics';
export const SUPPORT_FORM_PREFIX = 'support-form-v2';
const {
GRAPHQL_IOS_SUPPORT_GROUP_ID,
GRAPHQL_ANDROID_SUPPORT_GROUP_ID,
@@ -68,12 +73,16 @@ export class Group {
}
handleSupportFormDeeplinks(store: Store) {
// TODO: Incorporate grp info in analytics.
getInstance().track('usage', 'support-form-source', {
source: 'deeplink',
group: this.name,
});
store.dispatch(setStaticView(SupportRequestFormV2));
const selectedApp = store.getState().connections.selectedApp;
const selectedClient = store.getState().connections.clients.find(o => {
return o.id === store.getState().connections.selectedApp;
});
let errorMessage: string | undefined = undefined;
if (selectedApp) {
const {app} = deconstructClientId(selectedApp);
const enabledPlugins: Array<string> | null = store.getState().connections
@@ -101,10 +110,16 @@ export class Group {
}
}
if (unsupportedPlugins.length > 0) {
errorMessage = `The current client does not support ${unsupportedPlugins.join(
', ',
)}. Please change the app from the dropdown in the support form.`;
logPlatformSuccessRate(`${SUPPORT_FORM_PREFIX}-deeplink`, {
kind: 'failure',
supportedOperation: true,
error: errorMessage,
});
showStatusUpdatesForDuration(
`The current client does not support ${unsupportedPlugins.join(
', ',
)}. Please change the app from the dropdown in the support form.`,
errorMessage,
'Deeplink',
10000,
payload => {
@@ -116,6 +131,8 @@ export class Group {
);
}
} else {
errorMessage =
'Selected app is null, thus the deeplink failed to enable required plugin.';
showStatusUpdatesForDuration(
'Please select an app and the device from the dropdown.',
'Deeplink',
@@ -149,6 +166,16 @@ export class Group {
}),
),
);
logPlatformSuccessRate(
`${SUPPORT_FORM_PREFIX}-deeplink`,
errorMessage
? {
kind: 'failure',
supportedOperation: true,
error: errorMessage,
}
: {kind: 'success'},
);
}
}