piwikTracker.trackSiteSearch not logging keyword

Hi,

I have an ajax based search engine, which displays results after making ajax call.
During every search ajax call i call

function search(keyword) {

…do ajax searc …

piwikTracker.trackSiteSearch(keyword);

}

I have also added following to my template file (generic) footer just before

Problem is that piwikTracker.trackSiteSearch is not logging keyword into analystics

On the other hand if i load my webiste mydomain.com/search?q=keyword this gets logged as i have enabled search loggin in piwik.

But custom logging is not going through.

Console.log(piwikTracker) in search function shows piwikTracker structure.

Using piwik 1.9.1

Any suggestion how to debug or fix this.

Thanks

Any suggestions …

Am i missing something.

How can i enable debug on the site where i have added teh javascript code to check whats failing :frowning:

Maybe you are calling the trackSiteSearch too early, before piwikTracker was created?

I would recommend to use the asynchronous version: http://piwik.org/docs/javascript-tracking/#toc-asynchronous-tracking

we are going to migrate all docs and piwik UI to use async which solves this problem

Thanks Matt,

i checked httpd log on website where piwik is hosted and found that its getting the hit

“GET /piwik.php?search=tiger&search_count=false&idsite=1&rec=1&r=449196&h=1&m=20&s=57&url=http%3A%2F%2Fwww.mydomain.com%2Fsearch%3Fquery%3Dlion&_id=25ddc93b09aa14f5&_idts=1351610242&_idvc=3&_idn=0&_refts=0&_viewts=1351620981&pdf=0&qt=1&realp=0&wma=1&dir=0&fla=1&java=1&gears=0&ag=0&cookie=1&res=1280x800 HTTP/1.1” 200 43 “http://www.mydomain.com/search?query=lion” “Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20100101 Firefox/16.0”

replaced domain name with mydomain

I loaded my website mydomain.com/search?query=lion
then made an ajax search for tiger, which showed up in the httplog of piwik server.
But its not seen in the analytics report. What could be missing here ?

OK the request looks good. So maybe data is recorded. Do yo not see it in Visitors > Visitor Log for “today” ?

If not, enable debugging: http://piwik.org/docs/tracking-api/reference/#toc-debugging-the-tracking-api-requests
and you wlil see any error message

i checked visitor log and came to realization that since the post received containted the url which is like mydomain.com/search?query=lion as given below, Piwik registers search keyword from the url and there by doesnot register the value given by search=xxxx Looks like a bug, can we disable the url being sent in this scenario.

“GET /piwik.php?search=tiger&search_count=false&idsite=1&rec=1&r=449196&h=1&m=20&s=57&url=http%3A%2F%2Fwww.mydomain.com%2Fsearch%3Fquery%3Dlion&_id=25ddc93b09aa14f5&_idts=1351610242&_idvc=3&_idn=0&_refts=0&_viewts=1351620981&pdf=0&qt=1&realp=0&wma=1&dir=0&fla=1&java=1&gears=0&ag=0&cookie=1&res=1280x800 HTTP/1.1” 200 43 “http://www.mydomain.com/search?query=lion” “Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20100101 Firefox/16.0”

So in my case visitor log registers lion multiple times but never registers tiger or anyother search keyword given.

I think its a bug in code…
Matt: Can you look into this plz

Thanks for the bug report! I created a ticket and fixed it in: Site Search priority input should be Tracking API params, then parse the URL query · Issue #3502 · matomo-org/matomo · GitHub

Thanks, it works.
Other bug is in Site Search Keyword widget on dashboard. When we click on the “Next” to see next set of keywords, it says There is no data for this report and then shows 1 to 10 of Nan, which was previously showing 1 to 10 of 15

Though the Action -> Site Search - Keywords widget shows keywords from 10-15 on clicking Next, but then pagination shows up as 1 to 10 of NaN.

ok please upgrade to 1.9.2-b3 which fixes this issue: http://builds.piwik.org/piwik-1.9.2-b3.zip

Thanks Matt :slight_smile:
You are very helpfull and very quick.

One more question, where can I find more themes :slight_smile: