matomo-org / matomo-sdk-ios

Matomo iOS, tvOS and macOS SDK: a Matomo tracker written in Swift
MIT License
388 stars 164 forks source link

Bulk import API broken with Piwik 2.0? #36

Closed kristopherjohnson closed 10 years ago

kristopherjohnson commented 10 years ago

I upgraded my Piwik server to version 2.0 today, and now attempts to use the bulk import API result in a 500 response from the server.

I'll try to get more details when I have time, but for now I am just forcing the number of events per request to be 1 so that the non-bulk API is used.

mattab commented 10 years ago

We have fixed a bug in the bulk import and it's likely this could have created a bug in the iOS SDK bulk import. @mattiaslevin changing iOS to follow bulk API format should work. http://developer.piwik.org/api-reference/tracking-api#bulk-tracking let me know if you need more info to make iOS SDK

mattiaslevin commented 10 years ago

It looks like the bulk request changed the encoding of the request body to non url encoding (which is probably the correct thing in the first place).

I will make a fix and new release as soon as I have tested.

mattiaslevin commented 10 years ago

Fixed.

Piwik 2.0 require the JSON request body to be non-url encoded, this is now the default behaviour in the tracker.

If you are connecting to a Piwik 1.X server the request body should be url encoded. You can enable legacy encoding by defining the following marco in the .pch file in your project. #define PIWIK1_X_BULK_ENCODING Look in the iOS demo project for an example.

I will do some more testing then a new release and update the pod. The README file will be update with information how to select the correct encoding depending on server.

Thanks a bunch for pointing this out.