lytics / ios-sdk

MIT License
0 stars 0 forks source link

re-evaluate how rigid we want/need to be in explicit property/attribute/etc models #35

Closed markhayden closed 1 year ago

markhayden commented 1 year ago

Is there any way to add more flexibility in the property, attribute, and identifiers? The way it stands, we have to define individual models to pass data, but in practice, the event details are unlikely to be completely uniform, so the user would end up defining many complex models to implement the flexibility. Maybe this is preferred, but from what I've seen from others and have used in my own experience, we could do something like exponea has outlined here: https://github.com/exponea/exponea-ios-sdk/blob/develop/Documentation/TRACK.md#-track-event and another example screen shot from the particle ios SDK docs:

image

NOTE: we should discuss this before doing anything. it may vary well be that the more rigid method is preferred but if that's the case we need to be certain we can easily include nested structs or dicts as part of the model as well because that is a common use case to send something like:

{
   "properties": {
      "stuff": {
          "thing": 1,
          "thing": "two"
      }
   }
}

before:

image image

after:

image
mgacy commented 1 year ago

UserManagerTests.testUpdate() addresses the second part (ensuring support for nested types)

The SDK currently supports the following:

let properties: [String: AnyCodable] = [
    "my_property_1" : "my property 1 value",
    "info": "test from exponea SDK sample app",
    "some_number": 5
]

Lytics.shared.track(
    properties: properties)

It would be trivial to add additional method overrides to support:

Lytics.shared.track(
    name: "Test Dictionary",
    properties: [
        "my_property_1" : "my property 1 value",
        "info": "test from exponea SDK sample app",
        "some_number": 5
    ])
markhayden commented 1 year ago

this is fantastic. let me test this out a bit more tonight and tomorrow morning (also have all day Friday to heads down focus on testing) but this seems like it probably solves my immediate concern.