general usage analytics

This commit is contained in:
shamsmosowi
2021-09-15 21:46:50 +10:00
parent 402a3f36da
commit dfbac58e2c
5 changed files with 21 additions and 3 deletions

View File

@@ -15,6 +15,7 @@ import ErrorBoundary from "components/ErrorBoundary";
import { useStyles } from "./useStyles";
import { useProjectContext } from "contexts/ProjectContext";
import useDoc from "hooks/useDoc";
import { analytics } from "@src/analytics";
export const DRAWER_WIDTH = 512;
export const DRAWER_COLLAPSED_WIDTH = 36;
@@ -163,7 +164,13 @@ export default function SideDrawer() {
// color="secondary"
disabled={disabled}
onClick={() => {
if (setOpen) setOpen((o) => !o);
if (setOpen)
setOpen((o) => {
analytics.logEvent(
o ? "side_drawer_close" : "side_drawer_open"
);
return !o;
});
}}
>
<ChevronIcon className={classes.drawerFabIcon} />

View File

@@ -14,6 +14,7 @@ import { Button, DialogActions } from "@mui/material";
import { useProjectContext } from "contexts/ProjectContext";
import { FieldType } from "constants/fields";
import { getFieldProp } from "components/fields";
import { analytics } from "@src/analytics";
const selectedColumnsJsonReducer =
(doc: any) => (accumulator: any, currentColumn: any) => {
@@ -115,6 +116,9 @@ export default function Export({ query, closeModal }) {
const handleExport = async () => {
handleClose();
analytics.logEvent("export_table", {
type: exportType,
});
enqueueSnackbar("Preparing file. Download will start shortly.");
let querySnapshot = await query.get();
let docs = querySnapshot.docs.map((doc) => ({

View File

@@ -42,7 +42,6 @@ const useStyles = makeStyles((theme) =>
display: "flex",
minWidth: 100,
},
dropzone: {
height: 137,
borderRadius: theme.shape.borderRadius,

View File

@@ -15,6 +15,7 @@ import useRouter from "../../hooks/useRouter";
import { db } from "../../firebase";
import { name } from "@root/package.json";
import { SETTINGS, TABLE_SCHEMAS, TABLE_GROUP_SCHEMAS } from "config/dbPaths";
import { analytics } from "@src/analytics";
export enum TableSettingsDialogModes {
create,
@@ -112,7 +113,12 @@ export default function TableSettingsDialog({
router.history.push(values.id);
}
}
analytics.logEvent(
TableSettingsDialogModes.update ? "update_table" : "create_table",
{
type: values.tableType,
}
);
handleClose();
};

View File

@@ -20,6 +20,7 @@ import Step3Preview from "./Step3Preview";
import { ColumnConfig } from "hooks/useTable/useTableConfig";
import { useProjectContext } from "contexts/ProjectContext";
import { getFieldProp } from "components/fields";
import { analytics } from "@src/analytics";
export type CsvConfig = {
pairs: { csvKey: string; columnKey: string }[];
@@ -95,6 +96,7 @@ export default function ImportCsvWizard({
for (const col of config.newColumns) {
tableActions.column.add(col.name, col.type, col);
}
analytics.logEvent("import_csv");
// Close wizard
setOpen(false);
setTimeout(handleClose, 300);