Skip to content

Analytics traits() method returning currently modified data inside Plugin instead of data from last identify call #354

@seanperez29

Description

@seanperez29

Describe the bug
I configure an Analytics class on app launch and store that throughout an app session to ensure only one instance of it is being used. I am also configuring an enrichment plugin in which I am passing that instance. In the enrichment plugin I need to determine if something has changed between a previous identify call and the current one being made. The traits()method specifies that it Returns the traits that were specified in the last identify call, as a dictionary., however when accessing that method it is filled with data from the current identify call that I am making. I would expect in the enrichment plugin that I could have access to the data in the previous Identify call from the traits() method on Analytics, but then also have access to data that we are expecting to update to in the IdenfityEvent being passed to Identify inside the plugin. I haven't tested userId or anonymousId, but I suspect those may have the same result. Is this a bug or is my expectation/setup wrong? Thanks in advance!

To Reproduce
Steps to reproduce the behavior:

  1. Configure Analytics, enrichment plugin, and add the plugin to the Analytics instance
  2. Make a call to identify passing in modified traits from a previous identify call.
  3. Inside the enrichment Plugin the data of the traits() method on Analytics matches the traits data on the IdentifyEvent being passed to the Plugins identify call.

Expected behavior
Since the docs specify that the traits() on Analytics Returns the traits that were specified in the last identify call, as a dictionary., that's what I would have expected instead of the data matching the new IdentifyEvent being passed to the enrichment Plugin

Screenshots
I've blocked out the beginning of the email address, but essentially I am editing the email in my app and just toggling between the ending being ".co" and ".com", and both passes through the Plugin the data from the Analytics traits (which specify should being from the last identify call), match the traits from the current identify call being made.
Screenshot 2024-07-25 at 10 32 05 AM

Platform (please complete the following information):

  • Library Version in use: 1.5.11
  • Platform being tested: iOS 16 - Xcode 15.4
  • Integrations in use: Braze

Thanks for your assistance!

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions