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:
Laura Benz
2025-11-25 09:28:05 +00:00
committed by GitHub
parent c7345ac11e
commit 18bf4d99cd
2 changed files with 14 additions and 2 deletions
@@ -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);
};