Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Analytics event: RIGHT_CLICK_IMAGE (#1156)

Sasha Zoria77e4d5011e71
diff --git a/frontend/src/pages/image/_id/index.vue b/frontend/src/pages/image/_id/index.vue
index b2fc088b0..325c1c6e6 100644
--- a/frontend/src/pages/image/_id/index.vue
+++ b/frontend/src/pages/image/_id/index.vue
@@ -15,6 +15,7 @@
:height="imageHeight"
@load="onImageLoaded"
@error="onImageError"
+ @contextmenu="handleRightClick(image.identifier)"
/>
<VSketchFabViewer
v-if="sketchFabUid"
@@ -204,6 +205,12 @@ export default defineComponent({
const { sendCustomEvent } = useAnalytics()
+ const handleRightClick = (identifier: string) => {
+ sendCustomEvent("RIGHT_CLICK_IMAGE", {
+ identifier,
+ })
+ }
+
const sendGetMediaEvent = () => {
if (!image.value) {
return
@@ -228,6 +235,7 @@ export default defineComponent({
sketchFabUid,
onImageLoaded,
onImageError,
+ handleRightClick,
backToSearchPath,
sendGetMediaEvent,
diff --git a/frontend/src/types/analytics.ts b/frontend/src/types/analytics.ts
index 112541997..8a846497d 100644
--- a/frontend/src/types/analytics.ts
+++ b/frontend/src/types/analytics.ts
@@ -40,6 +40,15 @@ export type Events = {
/** the identifier of the image */
identifier: string
}
+ /**
+ * Description: The user right clicks a single image result, most likely to download it.
+ * Questions:
+ * - Do users right-click images often? Does this suggest downloading them directly,
+ * when not paired with a `GET_MEDIA` event?
+ */
+ RIGHT_CLICK_IMAGE: {
+ identifier: string
+ }
/**
* Click on the 'back to search' link on a single result
*