mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-28 12:58:48 +00:00
Search analytics event refactored
This commit is contained in:
parent
2797b68436
commit
b8ea217730
1 changed files with 5 additions and 4 deletions
|
|
@ -16,13 +16,14 @@ const useSearch = (queryParams) => {
|
|||
function emitSearchEvent() {
|
||||
timerId = null;
|
||||
const state = core.transport.getState('search');
|
||||
const query = state.selected.extra.find((extra) => extra[0] === 'search')[1];
|
||||
if (query !== null) {
|
||||
const responses_count = state.catalogs.filter((catalog) => catalog.content.type === 'Ready').length;
|
||||
if (state.selected !== null) {
|
||||
const [, query] = state.selected.extra.find(([name]) => name === 'search');
|
||||
const responses = state.catalogs.filter((catalog) => catalog.content.type === 'Ready');
|
||||
core.transport.analytics({
|
||||
event: 'Search',
|
||||
args: {
|
||||
query, responses_count
|
||||
query,
|
||||
responsesCount: responses.length
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue