Search Unity

Multliple users for the same DeviceUniqueIdentifier in Data Explorer

Discussion in 'Unity Analytics' started by AleXoNNNe, Aug 28, 2017.

  1. AleXoNNNe

    AleXoNNNe

    Joined:
    Sep 19, 2016
    Posts:
    18
    Hello guys.
    I need some help with ensuring Unity Analytics shows the actual number of users we have (vs. installs as happens by default). I found in a previous thread on this forum a suggestion to use Analytics.SetUserId and applied it but I still have some issues.
    This is what I did: I created a Segment ("Irina Phone") with one blank Custom Event, sent only by one of our developer's phone by the DeviceUniqueIdentifier (sent also through Analitycs.SetUserId). However when I look at Data Explorer and I select only "Irina Phone" Segment, it shows multiple users in a single day corresponding to the number of installs on that same device. So my issue isn't solved yet.

    My questions are:
    1 : What do I need to do to make a user ( in this example, "Irina Phone") trully unique.
    2 : How does Data Explorer counts the users, what id does it use?

    For the record, SystemInfo.deviceUniqueIdentifier is always the same no matter how many installs are made so the problem isn't from here.

    Thanks.
     
    LeenaKA likes this.
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  3. AleXoNNNe

    AleXoNNNe

    Joined:
    Sep 19, 2016
    Posts:
    18
    Thanks for the answer and for the link, it seems very usefull for my recent problem.
    Here is the code:
    Code (CSharp):
    1. public class AnalyticsManager
    2. {
    3.         public AnalyticsManager()
    4.         {
    5.                Debug.Log(SystemInfo.deviceUniqueIdentifier);
    6.  
    7.                AnalyticsResult res = Analytics.SetUserId(SystemInfo.deviceUniqueIdentifier);
    8.                Debug.Log("Unique id sent : " + res);
    9.  
    10.                if (SystemInfo.deviceUniqueIdentifier == "Irina's unique device id")
    11.                {
    12.                       Analytics.CustomEvent("Irina's Iphone7");
    13.                       Debug.Log("Unique custom event sent for Irina");
    14.                }
    15.         }
    16. }
    This object was created on the first Awake() from my game and i was thinking that maybe Analytics API wasn't initializated yet so for now it isn't anymore in that Awake.
     
    Last edited: Aug 29, 2017
  4. AleXoNNNe

    AleXoNNNe

    Joined:
    Sep 19, 2016
    Posts:
    18
    Ok, so i used Charles to view my events as they are sent from the game. Here are some screens that shows that Analytics.SetUserId is sent correcty but the next events doesn't use that id.

     
  5. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Upon further investigation here, SetUserID is not used as the userID for subsequent Custom Event calls. The SetUserID value is only surfaced via Raw Data Export, in the UserInfo data set, and is used to map our userid with an id of the customer's choosing. A new userid for Custom Events is created at first use and when another user logs onto the device and runs the app. However, if the app is reinstalled by a single user, then the userid would remain the same.
     
  6. AleXoNNNe

    AleXoNNNe

    Joined:
    Sep 19, 2016
    Posts:
    18
    Hi, JeffD.

    Many thanks for your answers, highly appreciated.

    Please help me understand what is the best way to make sure Data Explorer displays one single user per device (the question that is actually burning us) as i undestand SetUserId might not be the best solution.

    Also, regarding “However, if the app is reinstalled by a single user, then the userid would remain the same.” unfortunately this doesn’t happen. Please see below screenshots of user ids generated for the same device (my own) via different installs during yesterday. For each new install on the same device user id generates a new code.



    Many thanks
    Alex
     
  7. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Sorry for the confusion, you are correct. A reinstall will generate a new UserID. SetUserID should work for you, but would require Raw Data Export (a Pro feature)