segmentio / analytics-swift

The hassle-free way to add Segment analytics to your Swift app (iOS/tvOS/watchOS/macOS/Linux).

Repository from Github https://github.comsegmentio/analytics-swiftRepository from Github https://github.comsegmentio/analytics-swift

Traits payload is not attached to "track" events

blbnv opened this issue · comments

Describe the bug
Me and the team have identified the difference between iOS and Android SDK behaviours, when we added a custom value to the traits payload using identify(traits:) interface.

Then, during using Segment Debugger, I can see traits are attached to indentify event (expected), but they're not attached to any of other events - track, lifecycle.

Android SDK has pretty much the same integration code, but we can confirm the fact we see traits for every event that follows the identify one.

To Reproduce
Steps to reproduce the behavior:

  1. Launch the application with the valid Segment configuration
  2. Call identify(userId: yourUserId, traits: ["customField": "value"])
  3. Call a few track events after.
  4. Open Segment Debugger and click on identify event - you can see traits are attached to it
  5. Open any track event
  6. There are no traits attached to any of them

Expected behavior
Every track events from the step three should have traits attached.

Screenshots
If applicable, add screenshots to help explain your problem.

Platform (please complete the following information):

  • Library Version in use: 1.4.7
  • Platform being tested: iOS

Additional context

  • Maybe I am missing something from Android implementation, but I was not able to find it in documentation
  • I tried to look at the changelog for the last iOS SDK version, but was not able to find a fix or any context related to the issue reproted.

If you're looking for context.traits on non-identify events, this was by design to match analytics.js. See /examples/other_plugins/InjectTraits for an example of how to replicate the analytics-ios behavior.