Custom Variables are not shown properly on the Piwik application #2782
Labels
Bug
For errors / faults / flaws / inconsistencies etc.
worksforme
The issue cannot be reproduced and things work as intended.
Hello, I found a bug in the Piwik 1.6 regarding the custom variables which are sent via Piwik Java Tracker (org.piwik.SimplePiwikTracker.java, namely).
Even if I send tracking requests with more than 1 custom variables, Piwik application shows just only one custom variable.
I checked the source-code briefly, and it seems to be a bug in the following point.
-class : "Piwik_Tracker_Visit" (file:%PIWIK_HOME%/core/Tracker/Visit.php)
-method : getCustomVariables (line:1028)
Here is the snippet which seems to be wrong(from line:1049).
Here, we fetch custom variables with the index which starts with 0.
Also this index is stored on the variable "$id"
For example)
Looping should be following.
(1) first fetch -> $id:0 , $keyValue -> "CUSTOM_VAR_1->A"
(2) second fetch -> $id:1 , $keyValue -> "CUSTOM_VAR_2->B"
Continuously the "if" statement checks whether$id is smaller than 1or not.
If yes, this custom variable will be ignored by "continue" statement.
But the first custom variable is pointed by $id=0 because the index starts with 0.
As a result..
When only one custom variable is defined - no custom variable will be shown.
When more than one custom variables are defined - the first custom variable always drops out.
I could make sure by printing out $customVar.
$customVar :
In my case, the first one "Modelname" isn't shown always.
So I tried to correct the logic, as an example.
I did it by "+1" to $id in order that $id doen't have 0.
As I am not so familiar withphp as well as Piwik application, it would be helpful if you can give other good solutions.
But I would like to fix in order to show all custom variables which recieved from PiwikTracker.
Thanks a lot for your work and help :)
Rie
Keywords: Custom Variablies
The text was updated successfully, but these errors were encountered: