Unable to track site search

hi

I am trying to track site search on my personnal website, using Zenphoto CMS.
The internal search of this CMS not uses URL parameters so I use trackSiteSearch() in my Piwik Tracking Code (Piwik Tracking Code is generated by php code).

But it doesn’t work and I never had site search tracking on my reports.

On all pages (except search page), the Piwik code is like following

    <!-- Piwik Tracking Code -->
    <script type="text/javascript">
    	var _paq = _paq || [];
    	_paq.push(['setDocumentTitle', "Galerie"]);
    	_paq.push(['enableLinkTracking']);
    	_paq.push(['setDownloadExtensions', "zip"]);
    	_paq.push(['trackPageView']);
    	(function() {
    		var u = "//piwik.[my_domain_name].fr/";
    		_paq.push(['setTrackerUrl', u + 'piwik.php']);
    		_paq.push(['setSiteId', 4]);
    		var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
    		g.type = 'text/javascript'; g.async = true; g.defer = true; g.src = u + 'piwik.js';
    		s.parentNode.insertBefore(g, s);
    	})();
    </script>
    <!-- End Piwik Tracking Code -->

On search page, the Piwik code is like following

    <!-- Piwik Tracking Code -->
    <script type="text/javascript">
    	var _paq = _paq || [];
    	_paq.push(['setDocumentTitle', "Recherche"]);
    	_paq.push(['enableLinkTracking']);
    	_paq.push(['setDownloadExtensions', "jpg|zip"]);
    	_paq.push(['trackSiteSearch', "test", false, 5]);
    	(function() {
    		var u = "//piwik.[my_domain_name].fr/";
    		_paq.push(['setTrackerUrl', u + 'piwik.php']);
    		_paq.push(['setSiteId', 4]);
    		var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
    		g.type = 'text/javascript'; g.async = true; g.defer = true; g.src = u + 'piwik.js';
    		s.parentNode.insertBefore(g, s);
    	})();
    </script>
    <!-- End Piwik Tracking Code -->

But I can’t see any reports on search on “test” keyword.
Can’t you point my in the right direction and help me to solve this issue ?

If it may usefull, the link of my dev site : http://test.vincentbourganel.fr/
If you want to perform a search, follow search page and choose a keyword in the relevant input.
When you have page result, you have the specific piwik code to track site search.

Hi,

I looked through your site and can’t find an error.

The js client is sending the data back to the server:
http://piwik.vincentbourganel.fr/piwik.php?search=test&search_count=5&idsite=4&rec=1&[...]

The only thing I can think of is enabling debugging for the tracker and see if there is any error:
https://developer.piwik.org/api-reference/tracking-api#debugging-the-tracker

Can you explain where you can see this data ?
I have enabled debugging, so wait and see.

I have related questions (maybe trivial, maybe not):
1- to use trackSiteSearch() to track internal search, is there a specific configuration to set in my piwik admin?
2- where am I supposed to see reports of internal searches on my website?

I open the network tab of my browsers developer tools and look for a request including piwik.php.

Now that you have enabled debuging you can see a log if you open this request url in a browser window.

It seems to include the following lines:

DEBUG: Executing Piwik\Plugins\Actions\Tracker\ActionsRequestProcessor::processRequestParams()...
DEBUG: Detected Site Search keyword 'test'. 
DEBUG: - Search Results Count was '5'. 
DEBUG: NOTE: The Page URL was changed / removed, during the Site Search detection, was 'http://test.vincentbourganel.fr/page/search/', now is ''
DEBUG: Detected Site Search keyword 'test'. 
DEBUG: - Search Results Count was '5'. 
DEBUG: NOTE: The Page URL was changed / removed, during the Site Search detection, was 'http://test.vincentbourganel.fr/page/search/', now is ''
DEBUG: WARNING: URL looks invalid and is discarded

I a not completly sure what this means.

I have ran the exactly same request sent to your server against my piwik instance and it shows the same warning but the search appears in my visitor log
Screenshot_20170828_185309

What are your site settings?

I am using the default ones:
Screenshot_20170828_185440

My config is the same as your.
What are your defaults site search parametrers?

Mine are as following:

In my piwik visitor log, I can see your searches (from austria), but I can’t see mine!
In my reports, I can see keyword search, but, again, not mine!

I will test on another device (maybe I have a proxy issue on this one, as it’s on
a professional network).
Is there a way to see if a piwik request have been received and processed?

Hi,

visits from Austria definitely sound like my test worked. I guess that your piwik instance is working correctly and the problem is with your client.

Do you see your client in the visitor log? Are you using anything thats like an ad-blocker? Do you have do-not-track enabled?

As mentioned before you can check the network tab of your browsers developer tools and look for an request including piwik.php and see if it fails or open its url in a new tab

I have tested on my personnal PC and all my actions (searches included) are tracked by Piwik.
But on my professionnal PC, any actions are still not tracked.

I load the request that I have found with firebug and I have a look on debug.
I found theses lines:

[...]
DEBUG: Current datetime: 2017-08-29 12:44:33
DEBUG: Executing Piwik\Plugins\CoreHome\Tracker\VisitRequestProcessor::manipulateRequest()...
DEBUG: Executing Piwik\Plugins\Actions\Tracker\ActionsRequestProcessor::manipulateRequest()...
DEBUG: Executing Piwik\Plugins\SitesManager\Tracker\SitesManagerRequestProcessor::manipulateRequest()...
DEBUG: Executing Piwik\Plugins\CustomVariables\Tracker\CustomVariablesRequestProcessor::manipulateRequest()...
DEBUG: Executing Piwik\Plugins\CoreHome\Tracker\VisitRequestProcessor::processRequestParams()...
DEBUG: DoNotTrack header found!
DEBUG: Visitor excluded.
DEBUG: -> aborting due to processRequestParams method
DEBUG: -> Scheduled tasks not triggered.
[...]

So I have a look on my browser (FF ESR) options : there is an checked
option (and I can’t uncheck it) in Privacy tab : Request that sites not track you.

That is probably my issue…

I have a look on this documentation, and it’s well explained: https://piwik.org/docs/privacy/.

I have discover a feature of piwik that explain the low level of visitors compared on my website statistics.

Hi,

Yes this is intended. By default piwik respects the do not track setting in the browser settings.

https://piwik.org/docs/privacy/#step-4-respect-donottrack-preference

One more thing:

Don’t forget to disable tracking debugging when you are finished.