Track clear search

This commit is contained in:
ernstmul
2025-03-05 13:50:34 +01:00
parent 66cc2df308
commit 63ea62f0cb
2 changed files with 12 additions and 1 deletions
+2 -1
View File
@@ -344,5 +344,6 @@ export enum Submit {
SiteActivateDeployment = 'submit_site_activate_deployment',
RecordCreate = 'submit_dns_record_create',
RecordUpdate = 'submit_dns_record_update',
RecordDelete = 'submit_dns_record_delete'
RecordDelete = 'submit_dns_record_delete',
SearchClear = 'submit_clear_search'
}
@@ -10,6 +10,7 @@
import { clearSubPanels, popSubPanel, subPanels } from '../subPanels';
import { IconArrowSmRight } from '@appwrite.io/pink-icons-svelte';
import { Icon, Keyboard, Layout } from '@appwrite.io/pink-svelte';
import { Submit, trackEvent } from '$lib/actions/analytics';
/* eslint no-undef: "off" */
type Option = $$Generic<Omit<Command, 'group'> & { group?: string }>;
@@ -22,6 +23,7 @@
let selected = 0;
let usingKeyboard = false;
let contentEl: HTMLElement;
let didSearch = false;
async function triggerOption(option: Option) {
const prevPanels = $subPanels.length;
@@ -43,6 +45,14 @@
if (!open) return;
usingKeyboard = true;
if (search.length > 0) {
didSearch = true;
}
if (search === '' && didSearch) {
trackEvent(Submit.SearchClear);
}
let canceled = false;
dispatch('keydown', {
originalEvent: event,