matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.91k stars 2.65k forks source link

Incorrect tracking search result pages #19092

Open Bira-navi opened 2 years ago

Bira-navi commented 2 years ago

Hello,

I have a problem concerning the keywords searched on the site. I don't understand why, when a search is performed and displays for example 5 results, the column PAGES OF SEARCH RESULTS displays 4. On my site, 10 results can be displayed on the same page. I also have data when there are 0 results.

Thank you.

bx80 commented 2 years ago

Hi @Bira-navi, thanks for reporting this. Would it be possible for you to share a screenshot of the problem to help us understand it a little better?

Bira-navi commented 2 years ago

Hi @Bira-navi, thanks for reporting this. Would it be possible for you to share a screenshot of the problem to help us understand it a little better?

Hello, this is what i got :

Capture
sgiehl commented 2 years ago

@Bira-navi Are you using the javascript tracker to set the number of available search results?

Bira-navi commented 2 years ago

@Bira-navi Are you using the javascript tracker to set the number of available search results?

I don't know where i can verify this, but i think that yes ?

heurteph-ei commented 2 years ago

@Bira-navi is the tracked site a WordPress site or another one? What did you do in your site to be tracked by Matomo? (please copy-paste the code you used)

MatomoForumNotifications commented 2 years ago

This issue has been mentioned on Matomo forums. There might be relevant details there:

https://forum.matomo.org/t/incorrect-tracking-search-result-pages/45681/2

Bira-navi commented 2 years ago

@Bira-navi is the tracked site a WordPress site or another one? What did you do in your site to be tracked by Matomo? (please copy-paste the code you used)

I am not the one who launched Matomo on the portal.. I am not sure if its this code you want :

image image image image

heurteph-ei commented 2 years ago

How are your track defined?

lneuville commented 2 years ago

Hi, I'm experiencing the same issue on Matomo Analytics Cloud. I'm using Matomo Tag Manager. On the result page, I launch a Custom HTML Tag with : <script type="text/javascript"> _paq.push(['trackSiteSearch', {{DLV-searched_expression}}, {{DLV-searched-category}}, {{DLV-search-results-number}}]); </script> (on this page, I don't launch a Pageview Tag, following official Matomo's doc)

This Tag is triggered by a Custom Event, plugged on a Datalayer.Event "search" containing the requested data (searched expression, category, number of results).

In Administration, the Site search is also activated.

Thanks. Rgds

heurteph-ei commented 2 years ago

@lneuville Do you see the event / tag when using container preview mode? Do you see any JavaScript error in the browser console? Do you see any HTTP request to your Matomo after that tag execution?

In Administration, the Site search is also activated. If I don't do mistake, I think this is used for automatic search tracking thanks to params (like q=, query=, s=, search=, etc.) found in the page URLs

lneuville commented 2 years ago

Hi @heurteph-ei

Thanks for your questions ;

Do you see the event / tag when using container preview mode?

Yes. In preview mode, I see the Custom Event on the left bar, and the Custom HTML Tag launched

Do you see any JavaScript error in the browser console?

No error in the console

Do you see any HTTP request to your Matomo after that tag execution? Yes. After the matomo.js call, I see :

https://XXXXXX.matomo.cloud/matomo.php?search=emballage&search_count=13&idsite=6&rec=1&r=898653&h=15&m=47&s=24&url=https://dev-example.example.com/home/faq/search/emballage&_id=5909d5132f607567&_idn=0&_refts=0&send_image=0&pdf=1&qt=0&realp=0&wma=0&fla=0&java=0&ag=0&cookie=1&res=1920x1080&dimension1=Biens ménagers&dimension2=Approvisionnement et achat - Directeur&dimension3=Compte centralisé&dimension4=FORFAIT&dimension5=declarant, signataire_attestation_conformite&dimension7=FR

and then :

https://XXXXXX.matomo.cloud/matomo.php?fa_vid=hgkjXW&fa_ef=mat-input-0&fa_lf=mat-input-0&fa_fields=[{"fa_fts":6890,"fa_fht":5693,"fa_fb":true,"fa_fn":"mat-input-0","fa_fch":1,"fa_ff":1,"fa_fd":0,"fa_fcu":0,"fa_ft":"text","fa_fs":0}]&fa_ts=7546&fa_su=1&fa_tts=7546&ca=1&idsite=6&rec=1&r=699654&h=15&m=47&s=22&url=https://dev-example.example.com/home/faq/search/tri&_id=5909d5132f607567&_idn=0&_refts=0&send_image=0&pdf=1&qt=0&realp=0&wma=0&fla=0&java=0&ag=0&cookie=1&res=1920x1080&dimension1=Biens ménagers&dimension2=Approvisionnement et achat - Directeur&dimension3=Compte centralisé&dimension4=FORFAIT&dimension5=declarant, signataire_attestation_conformite&dimension7=FR

Regarding the activation of the Site Search setting, indeed, it seems necessary when you use the 'automatic' search tracking... but I have a doubt wether it's also necessary in 'Custom HTML Tag' based method. I'll give it a try.

best rgds Laurent

heurteph-ei commented 2 years ago

The second request seems to be related to another plugin (FormAnalytics, maybe), as fa_* parameters are not documented in the official API... If the ID site is the good one (6), then I think all your searches are well tracked.

Now the question is: "how is the Search Results pages calculated"...? Doing some quick test: image gives me 1 search "autre" with 2 pages of results, and another search "devbcompo" with also 2 pages of results. It seems that if for the same page view you have several identical searches events, then Matomo will consider this as a page navigation for the same search...