6

I am doing data analysis on Stack Exchange communities using data explorer. I am wondering how to identify anonymous users bc anon user Id is not consistent across tables.

So I learned that Users.Id == -1 refers to a group of anonymous users, not any automated agent according to this post.

However, the anon user appears as null in SuggestedEdit table, not -1 as in PostHistory and Users tables, according to this post.

Now I am confused as to how to treat null values in tables with UserId columns.. Is it safe to treat all nulls in UserId as anonymous users?

4
  • Just for curious. Does Id == -1 not conflict with Community user? Commented Mar 23, 2017 at 3:47
  • 1
    -1 is the Community user, not "a group of anonymous users". Some actions by anonymous users might be attributed to Community (can't remember off top of head), hence the correlation, but -1 does not mean "anonymous". Whether -1 and/or null is allowed in PostHistory depends on PostHistoryTypeId (I'm working on an answer about this). For the SuggestedEdits table null is anonymous, community will never actually suggest an edit (this is different than anonymous edits being credited to community later, which is not reflected in SuggestedEdits).
    – Jason C
    Commented Mar 23, 2017 at 5:38
  • 1
    For the most part the SEDE data is all consistent and sensical, but the system itself can be confusing. PS For PostHistory data.stackexchange.com/stackoverflow/query/646492 and data.stackexchange.com/stackoverflow/query/646500 (Type = PostHistoryTypeId) may be useful for experiments. I'll finish a thorough post on it as soon as I can but not today.
    – Jason C
    Commented Mar 23, 2017 at 5:39
  • 1
    Also note that for PostHistoryTypeId 24 (Suggested Edit Applied) the UserId will always be null, as nobody really "owns" this action. The user IDs of the user credited with the edit and the users who approved it are encoded in the Comment column for these entries. Actual IDs for those are elsewhere in PostHistory/SuggestedEdits somewhere, you can join on the revision GUIDs to see the correspondance (there's also SuggestedEditVotes).
    – Jason C
    Commented Mar 23, 2017 at 5:47

1 Answer 1

7

So I learned that Users.Id == -1 refers to a group of anonymous users

This is where you're getting tripped up, because it's just not true. The Community user simply takes ownership over certain actions that should have a user attached, but don't always. In the case of suggested edits, the Community user performs the final edit once the suggestion is approved, even though the author of the initial suggestion is anonymous.

In the database, -1 always refers to something attached to the Community user - something the system took responsibility for due to something else happening in the system. That something else isn't always related to an anonymous action, such as in the case of casting the final Approve or Reject vote when another user Improves an edit, or when the author of a question agrees with a duplicate close vote. Those weren't anonymous actions; we just don't attribute them to the user who was actually kind of responsible for causing them.

Anonymous users can't actually do anything other than suggest edits on our sites. So that's pretty much the only place you'll ever find a "truly anonymous" user that never existed. However, the database does not differentiate between different types of anonymous users. They're all just a null user ID in the database with some arbitrary text assigned as a display name, and could occur due to a variety of reasons:

  • An unauthenticated user suggested an edit.
  • The user was deleted.
  • The post was disassociated from the author's account.
  • The post was migrated and the user didn't have an account on the new site.
1
  • Anonymous users can't actually do anything other than suggest edits on our sites This clarifies many things. I think that the content of this post needs some additional explanation like this since the answer to that is quite misleading.
    – Layray
    Commented Mar 24, 2017 at 15:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .