Solved : Wrong quotation marks and antislashes included in the Piwik request


#1

Hello,

I’m tracking custom variables with Piwik but in the generated request to Piwik server, here what I get :

/piwik.php?action_name=my_action&idsite=2&rec=1&r=632817&h=18&m=26&s=12&url=http://www.xxxx.com/?cid=XXX&urlref=http:xxx.html&_id=565da35e40f66022&_idts=1446568377&_idvc=2&_idn=0&_refts=0&_viewts=1446571155&send_image=0&pdf=1&qt=0&realp=0&wma=0&dir=0&fla=1&java=1&gears=0&ag=0&cookie=1&res=1920x1080&cvar={“1”:"[“Var1”, “VAR0003719412”]",“2”:"[“Var2”, “0”]"}&gt_ms=277

The parameter which is matching to the custom variable is very weird because it has misplaced quotation mark : {“1”:"[“Var1”, “VAR0003719412”]",“2”:"[“Var2”, “0”]"} and antislashes coming from nowhere.
Result : these custom variables are not saved by Piwik.

When I try to send a request manually with this value : cvar={“1”: [“Var1”,“VAR0003719412”] ,“2”:[“Var2”,“0”]}, it works well.

I track my custom variables in a standard way :

_paq.push([‘setCustomVariable’, 1, ‘Var1’, ‘N°Identifiant’, ‘page’]);
_paq.push([‘setCustomVariable’, 2, ‘Var2’, ‘Montant’, ‘page’]);

Any clue of where did come from these quotations marks and antislashes ?

Thanks for any help,

Tia


(Matthieu Aubry) #2

you are likely using Prototype 1.6.0.3 which is known to be buggy re JSON. Please update Prototype to a more recent version.


#3

I updated it and it works well :slight_smile:

thank you !