Flagsmith / flagsmith

Open Source Feature Flagging and Remote Config Service. Host on-prem or use our hosted version at https://flagsmith.com/
https://flagsmith.com/
BSD 3-Clause "New" or "Revised" License
4.74k stars 358 forks source link

Anonymous Identities #168

Open dabeeeenster opened 3 years ago

dabeeeenster commented 3 years ago

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 commented 3 years ago

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 commented 2 years ago

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

kyle-ssg commented 2 years ago

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

jbtheard commented 1 year ago

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.

dabeeeenster commented 1 year ago

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

dabeeeenster commented 1 year ago

OK so current thinking is:

Questions

AChevallier commented 1 year ago

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.

taltcher commented 1 year ago

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

dabeeeenster commented 1 year ago

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.

Skwai commented 1 year ago

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

jbtheard commented 1 year ago

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.

dabeeeenster commented 1 year ago

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

taltcher commented 11 months ago

@dabeeeenster - any update regarding this?

dabeeeenster commented 11 months ago

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

taltcher commented 8 months ago

@dabeeeenster - any update regarding this?

matthewelwell commented 8 months ago

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 commented 2 months ago

This is on hold while we work on #4278 which will implement a lot of the necessary functionality needed for anonymous identities.