Send search_count parameter later

Hi!

I do the following: I track Page Search Requests using the Matomo Tracking PHP API. The problem is, the actual search is done client-side by a JavaScript call to an external API. This API then returns the search results.

So when sending the page view, I also send the search keyword and search category. But I do not have the result count. Can I somehow send this information afterwards, after the search API returned the results? I do already have the pageViewId on the client side.

Thank you!

I suggest you should disable the automatic search tracking.
And use the search tracking through the API (I imagine at some point, your PHP knows the search category, the search keyword and also the number of results):
https://developer.matomo.org/api-reference/PHP-Matomo-Tracker#dotracksitesearch

Sorry, I didn’t express myself well in my message. I already do search tracking using the API, but I don’t have the number of results in PHP.

So I have to do one of the following (and I don’t know, if they are possible):

  1. Send only the number of results in JavaScript
  2. Send first the page view and then in a later request search data (keyword, category, number of results)

I would prefer the first option, but I can imagine that this isn’t possible.

Thank you!