Skip to content
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

Tracking the redirected search terms #3451

Open
romainruaud opened this issue Nov 25, 2024 · 2 comments
Open

Tracking the redirected search terms #3451

romainruaud opened this issue Nov 25, 2024 · 2 comments
Assignees
Labels

Comments

@romainruaud
Copy link
Collaborator

The tracking mechanism is not triggered when a Redirect is created for a search term.

This is due to the fact, that, in case of a redirect, we never reach the search result page.

We should probably add a plugin on the search result controller : https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/CatalogSearch/Controller/Result/Index.php#L80

Most probably, we should reuse this one : https://github.com/Smile-SA/elasticsuite/blob/2.11.x/src/module-elasticsuite-catalog/Plugin/CatalogSearch/ResultPlugin.php#L114

And check if ($this->getResponse()->getRedirect()) we then have to fire a new event like the "smile_elasticsuite_redirect_if_one_result" but this time it will be "smile_elasticsuite_redirect_search_term" and then, we have to implement the event collecting in PHP, like for the "one result redirect" : https://github.com/Smile-SA/elasticsuite/blob/2.11.x/src/module-elasticsuite-tracker/Observer/TrackRedirectIfOneResult.php

@romainruaud
Copy link
Collaborator Author

(to create a redirect for a search term, go to Magento Back-Office and then Marketing > Search Terms. Pick one search term, and then add your redirect and save it).

@rbayet
Copy link
Collaborator

rbayet commented Nov 26, 2024

@romainruaud We also need to take into account headless themes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants