Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
seanperez29 opened this issue Jul 25, 2024 · 3 comments
Assignees
Labels

Comments

@seanperez29
Copy link

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!

@bsneed
Copy link
Contributor

bsneed commented Jul 26, 2024

This works as intended. I understand your use case, but I can't supply the previous traits because they've already been overwritten. You can work around this by storing traits in your own plugin as they come through so you can see what the previous traits were.

@bsneed bsneed closed this as completed Jul 26, 2024
@seanperez29
Copy link
Author

seanperez29 commented Jul 26, 2024 via email

@bsneed
Copy link
Contributor

bsneed commented Jul 26, 2024

My pleasure! Let me know if you need further assistance, happy to jump in and help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants