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

Site search is truncating the strings which is placed after ampersand (&) #14715

Open
KarthikRaja1388 opened this issue Jul 30, 2019 · 2 comments · May be fixed by #16628
Open

Site search is truncating the strings which is placed after ampersand (&) #14715

KarthikRaja1388 opened this issue Jul 30, 2019 · 2 comments · May be fixed by #16628
Labels
Bug For errors / faults / flaws / inconsistencies etc. c: Data Integrity & Accuracy Technical debt Issues the will help to reduce technical debt

Comments

@KarthikRaja1388
Copy link

In Site Search, part of keyword is getting ignored/truncated, when there is an ampersand (&) in the keyword (ex: Heatmap & session recording)

Expected: Report should contain the word "Heatmap & session recording"

Result: Can only see "Heatmap" in Visits log and also the Site Search report

Steps to reproduce:

  1. Search for "Heatmap & session recording"
    
  2. check the Visits Log and Site Search
    

Example site search:
site search error

Visits log:
site serach error visits log

@mattab mattab added this to the 3.13.0 milestone Jul 30, 2019
@mattab mattab added the Bug For errors / faults / flaws / inconsistencies etc. label Jul 30, 2019
@mattab mattab modified the milestones: 3.13.0, 4.1.0 Jul 31, 2019
@mattab
Copy link
Member

mattab commented Jul 31, 2019

In the meantime we can offer a workaround. The workaround is to manually call trackSiteSearch and replace manually your ampersand by another character. The steps to implement the workaround would be:

  1. do not call trackPageView on your search results page
  2. instead On your search result page, you would call piwikTracker.trackSiteSearch(keyword, category, searchCount) function to record the internal search request. Note: the 'keyword' parameter is required, but category and searchCount are optional.
_paq.push(['trackSiteSearch',
// Search keyword searched for
"Banana", // Here you want to replace & by another character
// Search category selected in your search engine. If you do not need this, set to false
"Organic Food",
// Number of results on the Search results page. Zero indicates a 'No Result Search Keyword'. Set to false if you don't know
0
]);
// We recommend not to call trackPageView() on the Site Search Result page
// _paq.push(['trackPageView']);

We also recommend to set the searchCount parameter, as Matomo will specifically report "No Result Keywords", ie. Keywords that were searched, but did not return any result. It is usually interesting to know what users search for but can't find (yet?) on your website.

  1. Replace ampersand by another character in the keyword in trackSiteSearch
    // Here you want to replace & by another character

See the JS site search tracking doc in: https://developer.matomo.org/guides/tracking-javascript-guide#internal-search-tracking

@sgiehl sgiehl self-assigned this Oct 28, 2020
@sgiehl sgiehl linked a pull request Oct 29, 2020 that will close this issue
@mattab mattab modified the milestones: 4.1.0, 4.2.0 Dec 21, 2020
@mattab mattab modified the milestones: 4.2.0, 4.3.0 Feb 22, 2021
@mattab mattab modified the milestones: 4.3.0, 4.4.0 May 26, 2021
@tsteur tsteur modified the milestones: 4.4.0, 4.7.0 Jul 25, 2021
@tsteur tsteur assigned sgiehl and unassigned sgiehl Jan 13, 2022
@tsteur
Copy link
Member

tsteur commented Jan 13, 2022

This might be fixed with #16628

If not, we won't schedule it just yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. c: Data Integrity & Accuracy Technical debt Issues the will help to reduce technical debt
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants