FeatureTracking: Adjust and add events (#114305)
* feat: add tracking for opening menu * refactor: add location to tracking event * refactor: apply changes from code review
This commit is contained in:
@@ -47,6 +47,14 @@ export const QuickAdd = ({}: Props) => {
|
||||
if (!showQuickAdd) {
|
||||
return null;
|
||||
}
|
||||
const handleVisibleChange = () => {
|
||||
if (!isOpen) {
|
||||
reportInteraction('grafana_create_new_button_menu_opened', {
|
||||
from: 'quickadd',
|
||||
});
|
||||
}
|
||||
setIsOpen(!isOpen);
|
||||
};
|
||||
|
||||
const MenuActions = () => {
|
||||
return (
|
||||
@@ -68,7 +76,7 @@ export const QuickAdd = ({}: Props) => {
|
||||
|
||||
return showQuickAdd ? (
|
||||
<>
|
||||
<Dropdown overlay={MenuActions} placement="bottom-end" onVisibleChange={setIsOpen}>
|
||||
<Dropdown overlay={MenuActions} placement="bottom-end" onVisibleChange={handleVisibleChange}>
|
||||
<ToolbarButton
|
||||
iconOnly
|
||||
icon={'plus'}
|
||||
|
||||
@@ -51,7 +51,11 @@ export default function CreateNewButton({
|
||||
const isProvisionedInstance = useIsProvisionedInstance();
|
||||
|
||||
const handleVisibleChange = () => {
|
||||
!isOpen && reportInteraction('grafana_create_new_button_menu_opened');
|
||||
if (!isOpen) {
|
||||
reportInteraction('grafana_create_new_button_menu_opened', {
|
||||
from: location.pathname,
|
||||
});
|
||||
}
|
||||
setIsOpen(!isOpen);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user