diff --git a/frontend/src/components/VAudioTrack/layouts/VFullLayout.vue b/frontend/src/components/VAudioTrack/layouts/VFullLayout.vue
index 3526fe1e644..603775b39e4 100644
--- a/frontend/src/components/VAudioTrack/layouts/VFullLayout.vue
+++ b/frontend/src/components/VAudioTrack/layouts/VFullLayout.vue
@@ -1,7 +1,6 @@
@@ -45,7 +42,6 @@ const { resultParams } = useRouteResultParams()
/>
diff --git a/frontend/src/components/VMediaInfo/VGetMediaButton.vue b/frontend/src/components/VMediaInfo/VGetMediaButton.vue
index 23fa974731d..85c26a02909 100644
--- a/frontend/src/components/VMediaInfo/VGetMediaButton.vue
+++ b/frontend/src/components/VMediaInfo/VGetMediaButton.vue
@@ -1,8 +1,8 @@
diff --git a/frontend/src/pages/audio/[id]/index.vue b/frontend/src/pages/audio/[id]/index.vue
index 585ef9e3c64..0e6d2252ad2 100644
--- a/frontend/src/pages/audio/[id]/index.vue
+++ b/frontend/src/pages/audio/[id]/index.vue
@@ -19,11 +19,13 @@ import type { AudioDetail } from "~/types/media"
import type { AudioInteractionData } from "~/types/analytics"
import { validateUUID } from "~/utils/query-utils"
+import { useAnalytics } from "~/composables/use-analytics"
import { useSensitiveMedia } from "~/composables/use-sensitive-media"
-import { usePageRobotsRule } from "~/composables/use-page-robots-rule"
import { useSingleResultStore } from "~/stores/media/single-result"
import singleResultMiddleware from "~/middleware/single-result"
+import { usePageRobotsRule } from "~/composables/use-page-robots-rule"
+
import VAudioTrack from "~/components/VAudioTrack/VAudioTrack.vue"
import VMediaReuse from "~/components/VMediaInfo/VMediaReuse.vue"
import VRelatedMedia from "~/components/VMediaInfo/VRelatedMedia.vue"
@@ -77,13 +79,12 @@ useHead(() => ({
title: pageTitle.value,
}))
-const { $sendCustomEvent } = useNuxtApp()
-
+const { sendCustomEvent } = useAnalytics()
const sendAudioEvent = (
data: Omit,
component: "AudioDetailPage" | "VRelatedAudio"
) => {
- $sendCustomEvent("AUDIO_INTERACTION", {
+ sendCustomEvent("AUDIO_INTERACTION", {
...data,
component,
})
diff --git a/frontend/src/pages/image/[id]/index.vue b/frontend/src/pages/image/[id]/index.vue
index 6851938b98b..b82d2326e52 100644
--- a/frontend/src/pages/image/[id]/index.vue
+++ b/frontend/src/pages/image/[id]/index.vue
@@ -18,14 +18,16 @@ import { computed, ref, watch } from "vue"
import { IMAGE } from "~/constants/media"
import { skipToContentTargetId } from "~/constants/window"
import type { ImageDetail } from "~/types/media"
+import { useAnalytics } from "~/composables/use-analytics"
import { useSensitiveMedia } from "~/composables/use-sensitive-media"
import { useSingleResultPageMeta } from "~/composables/use-single-result-page-meta"
-import { useRouteResultParams } from "~/composables/use-route-result-params"
-import { usePageRobotsRule } from "~/composables/use-page-robots-rule"
import { useSingleResultStore } from "~/stores/media/single-result"
import singleResultMiddleware from "~/middleware/single-result"
+import { usePageRobotsRule } from "~/composables/use-page-robots-rule"
+import { useRouteResultParams } from "~/composables/use-route-result-params"
+
import VBone from "~/components/VSkeleton/VBone.vue"
import VMediaReuse from "~/components/VMediaInfo/VMediaReuse.vue"
import VRelatedMedia from "~/components/VMediaInfo/VRelatedMedia.vue"
@@ -100,12 +102,12 @@ const showLoadingState = computed(() => {
return isLoadingThumbnail.value
})
-const { $sendCustomEvent } = useNuxtApp()
+const { sendCustomEvent } = useAnalytics()
const { resultParams } = useRouteResultParams()
const handleRightClick = () => {
- $sendCustomEvent("RIGHT_CLICK_IMAGE", resultParams.value)
+ sendCustomEvent("RIGHT_CLICK_IMAGE", resultParams.value)
}
const { reveal, isHidden } = useSensitiveMedia(image.value)
@@ -285,7 +287,6 @@ watch(error, (err) => {
diff --git a/frontend/src/stores/media/index.ts b/frontend/src/stores/media/index.ts
index d8194a433ad..8b1e92aa4ce 100644
--- a/frontend/src/stores/media/index.ts
+++ b/frontend/src/stores/media/index.ts
@@ -485,9 +485,14 @@ export const useMediaStore = defineStore("media", {
let errorData: FetchingError | undefined
if (page == 1) {
+ const { kind, query, collectionType, collectionValue } =
+ searchStore.searchParamsForEvent
$sendCustomEvent("GET_SEARCH_RESULTS", {
- mediaType: mediaType,
- query: queryParams.q,
+ kind,
+ query,
+ collectionType,
+ collectionValue,
+ mediaType,
resultsCount: mediaCount,
})
}
diff --git a/frontend/src/stores/search.ts b/frontend/src/stores/search.ts
index 82438409bcc..4075e84ac42 100644
--- a/frontend/src/stores/search.ts
+++ b/frontend/src/stores/search.ts
@@ -244,7 +244,7 @@ export const useSearchStore = defineStore("search", {
searchParamsForEvent(): SearchParamsForEvent {
return {
kind: this.strategy === "default" ? "search" : "collection",
- query: this.searchTerm,
+ query: this.strategy === "default" ? this.searchTerm : "null",
searchType: isSearchTypeSupported(this.searchType)
? this.searchType
: ALL_MEDIA,
diff --git a/frontend/src/types/analytics.ts b/frontend/src/types/analytics.ts
index 7e63ac2878f..006e18b25ca 100644
--- a/frontend/src/types/analytics.ts
+++ b/frontend/src/types/analytics.ts
@@ -88,11 +88,9 @@ export type Events = {
* - How often are searches returning fewer than one page of results?
* - How many results do most searches yield?
*/
- GET_SEARCH_RESULTS: {
+ GET_SEARCH_RESULTS: Omit & {
/** the media type being searched */
mediaType: SupportedMediaType
- /** The search term */
- query: string
/** The number of results found for this search */
resultsCount: number
}