Showing No data in average search result count in internal search

Hi,
In the internal search report, Average search result count is showing no data. How to configure it to get the search result count?

Thank you

Hi,
Welcome to the community!
Is the information about the query parameters available in the URL? If your URL doesn’t store query parameters, then you could try to handle it through Piwik PRO API methods, which can be found in this article: How can I track internal search with JavaScript function? | Piwik PRO help center

Also, another solution would be adding a search_count parameter to the URL through the use of a custom code tag or a custom variable. You can find more information about the search_count parameter here: Tracking HTTP API — Piwik PRO Analytics Suite 18.5 documentation

Hi,
Thank you for the reply. can you explain me what kind of variable type is suitable for this task?

Thank you.

It all depends on what you want to achieve here. What you could go with is custom JS variable or a page URL variable that would retrieve the page URL of your site and then in tags you could create a custom code tag that would use this variable to append the search parameter to the end of the URL.

Hi,
I created a custom JS variable called ‘resultCount’ as follows,

function() {
var totalResultsElement = document.querySelector(‘.total-results’);
var totalResultsValue = parseInt(totalResultsElement.textContent);

if (isNaN(totalResultsValue)) {
return 0;
} else {
console.log(totalResultsValue); // Output: 2090
return totalResultsValue;
}
}

But the value of this variable does not reflect within following function I created as a tag.

_paq.push([‘trackSiteSearch’,{{ search_term }},‘’,{{ resultCount}});

I’m using page view trigger for this tag.
what is the reason for this and how can I solve this.

Thanks

Lalantha

Hi,

Could you share with me a URL of the website on which you set this up? You can post it here or send it to me via private message.