-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update payload of collection search analytics events #3957
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -208,6 +208,27 @@ export const useSearchStore = defineStore("search", { | |
searchTypeIsSupported(state) { | ||
return isSearchTypeSupported(state.searchType) | ||
}, | ||
/** | ||
* Returns the unique string representation of the current collection | ||
* when making collection searches. | ||
*/ | ||
collectionValue(): null | string { | ||
if (this.collectionParams === null) { | ||
return null | ||
} | ||
|
||
switch (this.collectionParams.collection) { | ||
case "creator": { | ||
Comment on lines
+220
to
+221
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's been a while since I saw |
||
return `${this.collectionParams.source}/${this.collectionParams.creator}` | ||
} | ||
case "source": { | ||
return this.collectionParams.source | ||
} | ||
case "tag": { | ||
return this.collectionParams.tag | ||
} | ||
} | ||
}, | ||
}, | ||
actions: { | ||
getApiRequestQuery(mediaType: SupportedMediaType) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ import type { FilterCategory } from "~/constants/filters" | |
import { ResultKind } from "~/types/result" | ||
|
||
import { RequestKind } from "./fetch-state" | ||
import { Collection } from "./search" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This and the previous imports use relative path, while we usually use absolute. I'd prefer to use absolute paths everywhere (and add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmmm, it feels weird that ESLint didn't catch and report this. We should look into that, but separately from this PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, nice catch! These were auto imports from vscode so I didn't even check them. I'll fix |
||
|
||
export type AudioInteraction = "play" | "pause" | "seek" | ||
export type AudioInteractionData = Exclude< | ||
|
@@ -20,6 +21,19 @@ export type AudioComponent = | |
| "AudioSearch" | ||
| "AudioDetailPage" | ||
| "VAllResultsGrid" | ||
|
||
/** | ||
* Common properties related to searches | ||
* on collection pages, added in the | ||
* "Additional Search Views" project. | ||
*/ | ||
type CollectionProperties = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! |
||
/** If a collection page, the type of collection */ | ||
collectionType: Collection | null | ||
/** A string representing a unique identifier for the collection */ | ||
collectionValue: string | null | ||
} | ||
|
||
/** | ||
* Compound type of all custom events sent from the site; Index with `EventName` | ||
* to get the type of the payload for a specific event. | ||
|
@@ -101,11 +115,13 @@ export type Events = { | |
REACH_RESULT_END: { | ||
/** The media type being searched */ | ||
searchType: SupportedSearchType | ||
/** The kind of search reached (a collection, a standard search view, etc.) */ | ||
kind: ResultKind | ||
/** The search term */ | ||
query: string | ||
/** The current page of results the user is on. */ | ||
resultPage: number | ||
} | ||
} & CollectionProperties | ||
/** | ||
* Description: The user clicks the CTA button to the external source to use the image | ||
* Questions: | ||
|
@@ -269,7 +285,7 @@ export type Events = { | |
sensitivities: string | ||
/** whether the result was blurred or visible when selected by the user */ | ||
isBlurred: boolean | null | ||
} | ||
} & CollectionProperties | ||
/** | ||
* Description: When a user opens the external sources popover. | ||
* Questions: | ||
|
@@ -297,12 +313,14 @@ export type Events = { | |
LOAD_MORE_RESULTS: { | ||
/** The media type being searched */ | ||
searchType: SearchType | ||
/** The kind of search (a collection, a standard search view, etc.) */ | ||
kind: ResultKind | ||
/** The search term */ | ||
query: string | ||
/** The current page of results the user is on, | ||
* *before* loading more results.. */ | ||
resultPage: number | ||
} | ||
} & CollectionProperties | ||
/** | ||
* Description: Whenever the user sets a filter. Filter category and key are the values used in code, not the user-facing filter labels. | ||
* Questions: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌