New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
segment datas are wrong/inexistant because json decoding is missing #9027
Comments
Hi @ArnY thanks for investigating so much already and looking so deep into it. In general I can say that custom variables work quite well here. So it might be related to a specific browser or server. Which browser are you using? Do you have some details about the server? On which OS is it running and what's the Piwik version? There's a Can you maybe try if it still occurs if you track only one custom var? eg |
Since I noticed the bug on our production server on a segment which I removed my fix ($keyValue=json_decode($keyValue)) and only left one DEBUG Actions[2015-10-17 09:55:04] [979f0] Invalid custom variables I agree there's something strange with the fact that a very small On 10/17/2015 08:50 AM, Thomas Steur wrote:
Arnaud Abélard DSI Université de Nantes |
I can confirm the problem on ubuntu 14.4, php-5.5.9. |
One more intresting thing. If I set the value of my custom variable to "m.jobsintown.de", the value is tracked. Means, the type of $keyValue in https://github.com/piwik/piwik/blob/master/core/Tracker/Request.php#L553 is an array. _paq.push(['setCustomVariable', 1,"Domain","m.jobsintown.de",'visit']); if I set the value to "www.jobsintown.de" $keyValues is a json encoded string. _paq.push(['setCustomVariable', 1,"Domain","www.jobsintown.de",'visit']); |
That's very weird. I tried to reproduce but couldn't. I just had a look at the website and it is actually sent differently to Piwik:
vs
After debugging further I noticed that you are using Prototype 1.6.0.3 which is known to be buggy re JSON. Please update Prototype to a more recent version. See eg #2165 or #7945 (comment) |
After upgrading prototype, the problem was fixed. Thank you very much! |
Spot on! We used prototype.js 1.6.0.3 too but I actually upgraded it a few days ago for a completely unrelated reason! I had slightly modified Request.php to send to syslog user-agents of browsers encountering the problem and upgrading prototype.js did fix most of the problem, but even after the upgrade I'm still getting non decoded json arrays for each custom variables (about 1% of the visits). Most of them are using webkit browsers: Chrome and Safari. Might not be important, I just wanted to mention those, just in case. Thanks anyway! |
Those browsers probably still use the cached prototype.js |
On 10/27/2015 07:27 PM, Thomas Steur wrote:
My thought too, i'll keep an eye on it. |
I explained my problem on the forum: http://forum.piwik.org/read.php?2,129751
in short:
Segment datas are wrong or empty.
Custom variables are declared to the tracker like this:
in core/Tracker/Request.php the customVariable values are read out of Common::getRequestVar, but for some reason those are still json encoded instead of being an array as expected:
looks like there's a missing json_decode() in the foreach ($customVar as $id => $keyValue) loop.
I could commit a patch but I'm not sure of the implications since I haven't found any other bug reports on the subjet it must still be working for some people...
The text was updated successfully, but these errors were encountered: