Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Can I set user id after some custom event already triggered?

Discussion in 'Unity Analytics' started by cdytoby, Mar 9, 2017.

  1. cdytoby

    cdytoby

    Joined:
    Nov 19, 2014
    Posts:
    181
    We have an app need to be intergrated with analytic, and it requires user login to continue use it, but there are some actions user can do without login.

    So the question is, if I set user id after the user is login, how does unity treat the old events and newer events?
     
  2. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @cdytoby

    Unity Analytics creates a random, unique user ID per device. That id is associated with all events sent from that device. (If a user uninstalls and re-installs, they will get a new user ID.)

    Regarding your question, if you are using Analytics.SetUserId, then that ID will be associated with the generated user ID, so it will be linked to all events, even before the user was logged in.