-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(analytics): 1631 Add analytics (#249)
- Loading branch information
Showing
23 changed files
with
237 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* Plausible event namespace: EXPLORER_* | ||
* Since Data Portal and Explorer share the same Plausible account, we need to | ||
* namespace the events to differentiate between them. | ||
* | ||
* NOTE: If you modify this file, you must update Plausible custom event page for | ||
* both staging and prod environments as well. | ||
* Staging: https://plausible.io/cellxgene.staging.single-cell.czi.technology/settings/goals | ||
* Prod: https://plausible.io/cellxgene.cziscience.com/settings/goals | ||
*/ | ||
export enum EVENTS { | ||
EXPLORER_DIFF_EXP_BUTTON_CLICKED = "EXPLORER_DIFF_EXP_BUTTON_CLICKED", | ||
EXPLORER_CATEGORY_EXPAND_BUTTON_CLICKED = "EXPLORER_CATEGORY_EXPAND_BUTTON_CLICKED", | ||
EXPLORER_CELLSET_BUTTON_CLICKED = "EXPLORER_CELLSET_BUTTON_CLICKED", | ||
EXPLORER_SUBSET_BUTTON_CLICKED = "EXPLORER_SUBSET_BUTTON_CLICKED", | ||
EXPLORER_RESET_SUBSET_BUTTON_CLICKED = "EXPLORER_RESET_SUBSET_BUTTON_CLICKED", | ||
EXPLORER_MODE_LASSO_BUTTON_CLICKED = "EXPLORER_MODE_LASSO_BUTTON_CLICKED", | ||
EXPLORER_MODE_PAN_ZOOM_BUTTON_CLICKED = "EXPLORER_MODE_PAN_ZOOM_BUTTON_CLICKED", | ||
EXPLORER_CENTROID_LABEL_TOGGLE_BUTTON_CLICKED = "EXPLORER_CENTROID_LABEL_TOGGLE_BUTTON_CLICKED", | ||
EXPLORER_VISUALIZATION_SETTINGS_BUTTON_CLICKED = "EXPLORER_VISUALIZATION_SETTINGS_BUTTON_CLICKED", | ||
EXPLORER_UNDO_BUTTON_CLICKED = "EXPLORER_UNDO_BUTTON_CLICKED", | ||
EXPLORER_REDO_BUTTON_CLICKED = "EXPLORER_REDO_BUTTON_CLICKED", | ||
EXPLORER_LAYOUT_CHOICE_BUTTON_CLICKED = "EXPLORER_LAYOUT_CHOICE_BUTTON_CLICKED", | ||
EXPLORER_LAYOUT_CHOICE_CHANGE_ITEM_CLICKED = "EXPLORER_LAYOUT_CHOICE_CHANGE_ITEM_CLICKED", | ||
EXPLORER_FLOATING_BUTTON_CLICKED = "EXPLORER_FLOATING_BUTTON_CLICKED", | ||
EXPLORER_COLORBY_AUTHOR_CATEGORIES_BUTTON_CLICKED = "EXPLORER_COLORBY_AUTHOR_CATEGORIES_BUTTON_CLICKED", | ||
EXPLORER_COLORBY_HISTOGRAM_CONTINUOUS_BUTTON_CLICKED = "EXPLORER_COLORBY_HISTOGRAM_CONTINUOUS_BUTTON_CLICKED", | ||
EXPLORER_COLORBY_GENE_BUTTON_CLICKED = "EXPLORER_COLORBY_GENE_BUTTON_CLICKED", | ||
EXPLORER_SUGGEST_MENU_ITEM_CLICKED = "EXPLORER_SUGGEST_MENU_ITEM_CLICKED", | ||
EXPLORER_GENESET_EXPAND_BUTTON_CLICKED = "EXPLORER_GENESET_EXPAND_BUTTON_CLICKED", | ||
EXPLORER_GENESET_HEADING_EXPAND_BUTTON_CLICKED = "EXPLORER_GENESET_HEADING_EXPAND_BUTTON_CLICKED", | ||
EXPLORER_HANDLE_ADD_NEW_GENE_TO_GENESET_BUTTON_CLICKED = "EXPLORER_HANDLE_ADD_NEW_GENE_TO_GENESET_BUTTON_CLICKED", | ||
EXPLORER_SEE_ACTIONS_BUTTON_CLICKED = "EXPLORER_SEE_ACTIONS_BUTTON_CLICKED", | ||
EXPLORER_COLOR_BY_ENTIRE_GENESET_BUTTON_CLICKED = "EXPLORER_COLOR_BY_ENTIRE_GENESET_BUTTON_CLICKED", | ||
EXPLORER_MENU_BUTTON_CLICKED = "EXPLORER_MENU_BUTTON_CLICKED", | ||
EXPLORER_OPEN_CREATE_GENESET_DIALOG_BUTTON_CLICKED = "EXPLORER_OPEN_CREATE_GENESET_DIALOG_BUTTON_CLICKED", | ||
EXPLORER_SUBMIT_GENESET_BUTTON_CLICKED = "EXPLORER_SUBMIT_GENESET_BUTTON_CLICKED", | ||
EXPLORER_SUBMIT_GENE_BUTTON_CLICKED = "EXPLORER_SUBMIT_GENE_BUTTON_CLICKED", | ||
EXPLORER_DELETE_FROM_GENESET_BUTTON_CLICKED = "EXPLORER_DELETE_FROM_GENESET_BUTTON_CLICKED", | ||
EXPLORER_PLOT_X_BUTTON_CLICKED = "EXPLORER_PLOT_X_BUTTON_CLICKED", | ||
EXPLORER_PLOT_Y_BUTTON_CLICKED = "EXPLORER_PLOT_Y_BUTTON_CLICKED", | ||
EXPLORER_MAXIMIZE_GENE_BUTTON_CLICKED = "EXPLORER_MAXIMIZE_GENE_BUTTON_CLICKED", | ||
EXPLORER_CATEGORY_SELECT_BUTTON_CLICKED = "EXPLORER_CATEGORY_SELECT_BUTTON_CLICKED", | ||
EXPLORER_CATEGORICAL_VALUE_SELECT_BUTTON_CLICKED = "EXPLORER_CATEGORICAL_VALUE_SELECT_BUTTON_CLICKED", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { EVENTS } from "./events"; | ||
|
||
declare global { | ||
interface Window { | ||
plausible: { | ||
q: unknown[]; | ||
(event: EVENTS, options?: { props: { [key: string]: unknown } }): void; | ||
}; | ||
} | ||
} | ||
|
||
export function track(event: EVENTS, props?: Record<string, unknown>): void { | ||
const options = props ? { props } : undefined; | ||
|
||
try { | ||
window.plausible(event, options); | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.