trackSiteSearch does not list results

hi

frist post from me :wink: … just installed piwik yesterday and am really impressed and happy!
my problem, no site searches are visible in piwik :frowning:

the setup:

  • typo3 6.2.11 (latest LTS release)
  • realurl for rewriting urls via apache mod_rewrite
  • indexed_search incl. the latest version of the extension ms_piwik_indexedsearch
  • latest piwik version, just donwloaded and installed yesterday

the websites domain is e.g.
http://www.mydomain.tld
piwik is installed just for this domain on a subdomain with it’s own database (not sharing the typo3 database)
http://piwik.mydomain.tld

ok, so I created the tracking code and inserted in the websites footer before the closing body tag on all pages.
code looks like this:


<!-- Piwik -->
<script type="text/javascript">
  var _paq = _paq || [];
  _paq.push(['trackPageView']);
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="//piwik.mydomain.tld/";
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['setSiteId', 1]);
    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>
<noscript><p><img src="//piwik.mydomain.tld/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->

I added the searchword from the typo3 indexed search extension to the search settings for my website 'sword’
so far so good! :wink:
tracking in general works … but no data in piwik for internal search words :frowning:

so I looked at the JS in the sourcecode of my websites frontend.
it is as stated propperly inserted on all pages, just before the closing body tag.

when calling a normal site the sourcecode looks like stated above, and I can see in safari in the resources window of developer tools
http://piwik.mydomain.tld/piwik.js
is called and included.

when I call the searchsite like http://www.mydomain.tld/search.html (as stated mod_rewrite is running and it is normally sth. like http://www.mydomain.tld/index.php?id=123) the http://piwik.mydomain.tld/piwik.js is still called, and the call of the site is tracked propperly in piwik, no matter if I enable or disable mod_rewrite.

now I fill out the searchform and e.g. search for ‘test’ on either http://www.mydomain.tld/search.html or http://www.mydomain.tld/index.php?id=123 and submit the form.
on the search result page, wich is than still http://www.mydomain.tld/search.html or http://www.mydomain.tld/index.php?id=123 I get the 12 results listed under the form and the tracking JS in sourcecode looks like e.g. this:


<!-- Piwik -->
<script type="text/javascript">
  var _paq = _paq || [];
  _paq.push(['trackSiteSearch', ("test", false, 12)];
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="//piwik.mfvt.web.my1.cc/";
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['setSiteId', 1]);
    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>
<noscript><p><img src="//piwik.mfvt.web.my1.cc/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->

searchin for e.g. ‘alsdhlk’ returns 0 results and the piwik JS looks like this:


<!-- Piwik -->
<script type="text/javascript">
  var _paq = _paq || [];
  _paq.push(['trackSiteSearch', ("alsdhlk", false, 0)];
  _paq.push(['enableLinkTracking']);
  (function() {
    var u="//piwik.mfvt.web.my1.cc/";
    _paq.push(['setTrackerUrl', u+'piwik.php']);
    _paq.push(['setSiteId', 1]);
    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>
<noscript><p><img src="//piwik.mfvt.web.my1.cc/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->

this makes me think and believe, that the settings I made in piwik and the searchkey ‘sword’ are correct.

yet there is nothing listed in piwik :frowning:

than I looked around and found out, that on the search result page, for what ever reason
http://piwik.mydomain.tld/piwik.js
is not in safaris resources window listed, thus not executed.

sorry for the long explanation, I try to describe as best as I can and according to my skills, in order to provide best info for you to help me out please.

so where am I wrong and why are no internal searches tracked in piwik?

I read the piwik-devpage regarding manually inserting the JS function trackSiteSearch … and must admid, that is beyond my skills.
fiddeled around, browsed the web and still am stuck.

any help/support to get internal site searches tracked would be highly appreciated.
thy for reading and helping me out!

rgds,
dahui

oh btw … please bare with my english, I am italian native living in germany, and that is hard enough :wink:

… oh my god stupid me … sorry :frowning:

the typo3 generated a wrong line of code


_paq.push(['trackSiteSearch', ("test", false, 12)];

the last closing round bracket was missing, I corrected it to


_paq.push(['trackSiteSearch', ("test", false, 12)]);

and now I get results in piwik! … finally.

BUT … now there is the enxt problem.
piwik shows just numbers and no searchtrings

https://dl.dropboxusercontent.com/u/2340708/piwik/search_results.png

this time I think I am really stuck :frowning:

rgds dahui

Dunno if you found a solution for this already, but you should not have a parenthesis “()” in your javascript statement

Change it to this:


_paq.push(['trackSiteSearch', 'test', false, 12]);

I was having a similar problem and got it resolved. Also, avoid using different quote types, like " and ’ in the same statement. That might mess it up.

Check the guide here
https://developer.piwik.org/guides/tracking-javascript-guide