Closed alexanderdean closed 9 years ago
Will get that fixed now.
Add a new test too please...
Hey @alexanderdean I thought this double wrapping was actually by design. When designing a SelfDescribingJson to box a UnstructuredEvent it needs to be wrapped within this block:
{"schema":"iglu:com.snowplowanalytics.snowplow/unstruct_event/jsonschema/1-0-0","data": { ... }}
The schema you define when creating the JSON to track should then relate to your specific data set that you would like to Track. For example:
SelfDescribingJson json = new SelfDescribingJson("iglu:com.snowplowanalytics.snowplow/your_event_schema/jsonschema/1-0-0", map);
tracker.trackUnstructuredEvent(json);
This would in turn result in the desired output of:
{"schema":"iglu:com.snowplowanalytics.snowplow/unstruct_event/jsonschema/1-0-0","data": {"schema":"iglu:com.snowplowanalytics.snowplow/your_event_schema/jsonschema/1-0-0","data":{ ... }}
In short the function will put the SelfDescribingJson with your personal schema and data inside another SelfDescribingJson which we understand to be an unstruct_event.
You are totally right @jbeemster - my bad. Not a bug, closing. @duncan - holla if the expl is not clear...
Ah. My bad then. This isn't how the output is coming through from the iOS/Mac OS trackers.... At least without the extra wrapping. I was making the assumption that a single layer was all that was needed.
One difference here is that iOS/Mac has a method to send unstructured events without a schema—which is how my mind view was set... This library doesn't—at least not that I've seen so far :)
That explains it I think. I just checked a Mountebank POST for a screen_view (which uses unstruct event under the cover) and it looked okay to me:
POST /com.snowplowanalytics.snowplow/tp2 HTTP/1.1
host: localhost:4545
content-type: application/x-www-form-urlencoded
connection: keep-alive
accept: text/html, application/x-www-form-urlencoded, text/plain, image/gif
user-agent: FeedbinNotifier/6 CFNetwork/720.2.4 Darwin/14.1.0 (x86_64)
accept-language: en-us
content-length: 955
accept-encoding: gzip, deflate
{"schema":"iglu:com.snowplowanalytics.snowplow\/payload_data\/jsonschema\/1-0-0","data":[{"aid":"feedbin-notifier","res":"3360x2100","p":"mob","cx":"eyJzY2hlbWEiOiJpZ2x1OmNvbS5zbm93cGxvd2FuYWx5dGljcy5zbm93cGxvd1wvY29udGV4dHNcL2pzb25zY2hlbWFcLzEtMC0wIiwiZGF0YSI6W3sic2NoZW1hIjoiaWdsdTpjb20uc25vd3Bsb3dhbmFseXRpY3Muc25vd3Bsb3dcL2Rlc2t0b3BfY29udGV4dFwvanNvbnNjaGVtYVwvMS0wLTAiLCJkYXRhIjp7ImRldmljZU1hbnVmYWN0dXJlciI6IkFwcGxlIEluYy4iLCJvc1ZlcnNpb24iOiIxMC4xMC4yIiwib3NUeXBlIjoib3N4IiwiZGV2aWNlTW9kZWwiOiJNYWNCb29rUHJvMTEsMSJ9fV19","dtm":"1423837808702","tv":"osx-0.1.0","tna":"test","ue_px":"eyJzY2hlbWEiOiJpZ2x1OmNvbS5zbm93cGxvd2FuYWx5dGljcy5zbm93cGxvd1wvdW5zdHJ1Y3RfZXZlbnRcL2pzb25zY2hlbWFcLzEtMC0wIiwiZGF0YSI6eyJzY2hlbWEiOiJpZ2x1OmNvbS5zbm93cGxvd2FuYWx5dGljcy5zbm93cGxvd1wvc2NyZWVuX3ZpZXdcL2pzb25zY2hlbWFcLzEtMC0wIiwiZGF0YSI6eyJpZCI6IjEyMyIsIm5hbWUiOiJzdGFydHVwIn19fQ==","e":"ue","lang":"en","vp":"3360x2100","eid":"c6646379-8e98-4979-b2b4-ba05825cbca1"}]}
Base64 decoded the ue_px
:
{"schema":"iglu:com.snowplowanalytics.snowplow\/unstruct_event\/jsonschema\/1-0-0","data":{"schema":"iglu:com.snowplowanalytics.snowplow\/screen_view\/jsonschema\/1-0-0","data":{"id":"123","name":"startup"}}}
@jbeemster - how come the test suite didn't pick this up? Please add a test to check this...
https://github.com/6wunderkinder/snowplow-android-tracker/commit/477b12a18457ad16bf74f4b9e8f019b57880e515
Many thanks for raising @duncan