flagsmith icon indicating copy to clipboard operation
flagsmith copied to clipboard

Anonymous Identities

Open dabeeeenster opened this issue 4 years ago • 18 comments
trafficstars

Anonymous Identity handling improvements:

  1. Add a way of signalling that an identity is "Anonymous" within all the SDKS when identifying a user. Anonymous identities prevent a record from being stored in the Flagsmith database, but provides the data to bucket the user in segments/mv flags etc.
  2. If an anonymous user then authenticates, the SDK would call the merge method.
  3. Create a new anonymous_id property that the identify endpoint can accept
  4. It stores the old ID in a new field anonymous_id and makes the new ID the primary Identity ID so that administrators can search on the primary ID.

If present, the field anonymous_id is always used when calculating segment buckets/MV flags etc. This is to prevent a user moving between buckets before/after a merge.

What to do if we are asked to merge an Identity that already exists?

We overwrite the new anonymous_id with the existing anonymous_id

dabeeeenster avatar Jul 07 '21 14:07 dabeeeenster

We need to figure out the best design for the SDK interface. For example, the Java SDK has:

FeatureUser user = new FeatureUser();
user.setIdentifier(identifier);

FlagsAndTraits flagsAndTraits = flagsmithClient.identifyUserWithTraits(FeatureUser user, Arrays.asList(
    trait(null, "trait1", "some value1"),
    trait(null, "trait2", "some value2")));

For anonymous identities, suggest:

FeatureUser user = new FeatureUser();
user.setAnonymousIdentifier(identifier);

FlagsAndTraits flagsAndTraits = flagsmithClient.identifyUserWithTraits(FeatureUser user, Arrays.asList(
    trait(null, "trait1", "some value1"),
    trait(null, "trait2", "some value2")));

dabeeeenster avatar Sep 15 '21 10:09 dabeeeenster

We also need to consider how this is handled with the Analytics integrations.

dabeeeenster avatar Oct 13 '21 13:10 dabeeeenster

I can't do much on this my side, it might be worth assigning an issue to the JS SDK / for the admin panel when we add a filter. I think also it might be worth considering making this a trait rather than a new field so that users can segment on anon users

kyle-ssg avatar Apr 10 '22 10:04 kyle-ssg

This, to me, is a must have feature as more and more UX will push for a deferred account creation; ie wait until (anonymous) user has experienced enough value before asking him to convert into a logged user. It surely is a trend and we want to start A/B testing way before user has created an account.

jbtheard avatar Feb 09 '23 14:02 jbtheard

We do want to get to this - most likely Q2 2023.

dabeeeenster avatar Feb 09 '23 15:02 dabeeeenster

OK so current thinking is:

  • SDKs can use the existing endpoints, but can optionally pass an identity_seed value that is used for the flagsmith engine to compute MV values/splits. This would be used for anonymous browser/user etc so they have a consistent experience. The SDK would be required to store that identity_seed on the device.
  • SDKs have a new method defined, alias that takes a generated GUID and the user's actual identifier once they have logged in. The API would store the anonymous seed GUID alongside the Identity for future MV/split calcuations.

Questions

  • What happens if an SDK calls getIdentityFlags with a seed as an Identity?
  • Do we prevent any seeds being stored as identities?
  • Does getIdentityFlags(seed) and getIdentityFlags(identifier) do the same thing if there is the identifier and seed data in the DB?
  • We don't need to store the seed if there are no traits, but if there are traits, do we assume they are transient and on the client?

dabeeeenster avatar Mar 01 '23 12:03 dabeeeenster

It looks very nice. I am using "Segment aliasing" with Mixpanel and the system is working very well. https://segment.com/docs/connections/spec/alias/

@dabeeeenster Maybe a Identity should have 2 ids (primary key), one seed_id and one user_id which should be null if no identify(), like Segment.

We can imagine an app with half of the application does not required to be logged in. So it would be important to store the traits of a seed.

AChevallier avatar Mar 13 '23 15:03 AChevallier

@dabeeeenster do you have an estimation of when this feature will be available?

taltcher avatar Jun 20 '23 16:06 taltcher

Not currently. We'd like to get it complete next quarter but we still have a backlog of Enterprise features we are working through, sorry.

dabeeeenster avatar Jun 20 '23 16:06 dabeeeenster

Still no progress on this? Still doesn't seem to be a way to use anonymous_ids

Skwai avatar Aug 11 '23 06:08 Skwai

Seriously considering moving away from Flagsmith for this very reason. Too bad this long awaited request hasn't been prioritized so far. Very useful for consumer focused businesses.

jbtheard avatar Aug 11 '23 07:08 jbtheard

We are about to start work on this - thanks for hanging in there people!

dabeeeenster avatar Aug 11 '23 09:08 dabeeeenster

@dabeeeenster - any update regarding this?

taltcher avatar Oct 14 '23 20:10 taltcher

It has slipped! We are planning on building this the current quarter.

dabeeeenster avatar Oct 17 '23 07:10 dabeeeenster

@dabeeeenster - any update regarding this?

taltcher avatar Dec 22 '23 06:12 taltcher

Hi @taltcher, we are progressing this but it's still in progress I'm afraid, we have had other priorities for our enterprise product this year. We have updated the content of the discussion here which details our proposed implementation of identity contexts, and anonymous identities. If you have any additional feedback on the proposal, we'd love to hear it.

We are hoping to make more progress on the development early next year and will of course keep you updated on this issue.

matthewelwell avatar Dec 22 '23 08:12 matthewelwell