All questions

When I call anonymize on logout, what actually happens to the profile?

Asked by Nadia on

NNadia

I call croct.identify on login and croct.anonymize on the logout. I want to understand exactly what anonymize does under the hood.

Specifically: does it detach the session from the identified user going forward, or does it touch stored data too? Trying to reason about it precisely before I ship.

Was this helpful?

2 answers

MKMarta KowalczykAccepted answer

It is a going-forward switch, not a data operation. croct.anonymize() returns the current session to anonymous, so events after that point are no longer attributed to the identified user. It does not scrub or rewrite anything already stored.

The way to think about it: identify and anonymize are how you switch the active identity of the session. That is also why the userId and token init options are mutually exclusive with this flow, you pick one mechanism for setting identity, you do not mix both.

If you re-identify later, that can relink through identity resolution's matching rules, it does not merge the anonymous history back in wholesale. The React identify and anonymize auth flow thread has the placement details if you want to double-check where the calls sit.

Was this helpful?
Hhans_k

Adding the part that surprised me at first: anonymous and identified profiles never associate with each other for sync purposes. So anonymize is not moving data between two profiles, it is just changing which identity the session is currently operating as. Kept me from expecting a merge that never happens.

Was this helpful?
NNadia

That matches what I see in the profile explorer. Anonymous events stop landing on the identified user the moment I call anonymize, and nothing retroactively moves. Exactly the behaviour I wanted.

Still have questions?