@anonymous-piwik-user opened this Issue on March 12th 2014

in order to push bulk tracking requests, you have to use json, i shouldn't have to escape the cvar json in order to put it in a json object.

this is how i currently have to submit a request:

{"requests": ["{\"1\": \"name\", \"value\"}", "res": "1366x768", "url": "http://www.blah.com/blah/", "search_count": "54", "search": "termhere", "cdt": "2014-03-11 00:00:00", "cip": "", "urlref": "http://www.ref.com/refstuff/", "idsite": "1", "rec": "1", "_id": "aaaaa563aaaaa51a", "ua": "mozilla/5.0 (compatible; msie 9.0; windows nt 6.1; trident/5.0)"}], "token_auth": "tokenhere"}

{"cvar": "{\"1\": \"value\"}",

should be able to be submitted as this
{"cvar": "{"1": "value"}",

none of this is mentioned in the documentation, and the documentation incorrectly states that i should be using an json array of urls with url encoded parameters, when i really have to use json throughout


here is the backtrace when trying to submit an un escaped request

Warning: json_decode() expects parameter 1 to be string, array given in /export/home/web/public/htdocs/projects/applog/piwik/core/Common.php on line 600

Backtrace -->
#0 Piwik\Error::errorHandler(...) called at [:]
#1 json_decode(...) called at [/export/home/web/public/htdocs/projects/applog/piwik/core/Common.php:600]
#2 Piwik\Common::json_decode(...) called at [/export/home/web/public/htdocs/projects/applog/piwik/core/Common.php:419]
#3 Piwik\Common::getRequestVar(...) called at [/export/home/web/public/htdocs/projects/applog/piwik/core/Tracker/Request.php:350]
#4 Piwik\Tracker\Request->getCustomVariables(...) called at [/export/home/web/public/htdocs/projects/applog/piwik/core/Tracker/Action.php:111]
#5 Piwik\Tracker\Action->getCustomVariables(...) called at [/export/home/web/public/htdocs/projects/applog/piwik/core/Tracker/ActionSiteSearch.php:84]
#6 Piwik\Tracker\ActionSiteSearch->getCustomVariables(...) called at [/export/home/web/public/htdocs/projects/applog/piwik/core/Tracker/Action.php:284]
#7 Piwik\Tracker\Action->record(...) called at [/export/home/web/public/htdocs/projects/applog/piwik/core/Tracker/Visit.php:167]
#8 Piwik\Tracker\Visit->handle(...) called at [/export/home/web/public/htdocs/projects/applog/piwik/core/Tracker.php:836]
#9 Piwik\Tracker->trackRequest(...) called at [/export/home/web/public/htdocs/projects/applog/piwik/core/Tracker.php:245]
#10 Piwik\Tracker->main(...) called at [/export/home/web/public/htdocs/projects/applog/piwik/piwik.php:106]

@anonymous-piwik-user commented on March 12th 2014

it seems like bulk tracking still has some edge cases in it, but i would like to let you know i appreciate all your hard work, and really enjoy the product

@mattab commented on December 1st 2014 Owner

this should work now, please open new issue in case you experience this

This Issue was closed on December 1st 2014
Powered by GitHub Issue Mirror