Search Unity

Setting up user attributes and UserID

Discussion in 'Unity Analytics' started by SeashellsRacer, Apr 10, 2015.

  1. SeashellsRacer

    SeashellsRacer

    Joined:
    Oct 16, 2014
    Posts:
    13
    Trying to set up some user attributes but it doesn't seem to be working. specifically gender. Age has issues too but I think they are related. Does the order in which you set the attributes, initialize analytics, set userid matter?


    All current Users segment has members but for some reason gender doesn't have any members. Our custom age segments don't seem to be working either. However the built in age segments work fine.

    Here's how I kinda have it setup.
    Code (CSharp):
    1.  
    2. if(!isInitDataSet)
    3.         UnityAnalytics.StartSDK (ANALYTICS_ID);
    4.  
    5. if(isLoggingIn) //check to make sure they are playing with a logged in account not a quick game
    6. {
    7.         UnityAnalytics.SetUserGender(sex);
    8.         UnityAnalytics.SetUserBirthYear(birthyear);
    9.         UnityAnalytics.SetUserId(PlayerDatabase.PlayerID);
    10. }
    11. else
    12. {
    13.         UnityAnalytics.SetUserGender(SexEnum.U);
    14.         UnityAnalytics.SetUserBirthYear(1900);
    15.         UnityAnalytics.SetUserId(SystemInfo.UniqueDeviceIdentifier);
    16. }
    17.  
    In our game you can have up to 3 accounts per device. PlayerDatabase.PlayerID retrieves a unique id created for that player from our own server.
     
  2. sschan

    sschan

    Moderator

    Joined:
    Oct 8, 2014
    Posts:
    87
    Hi @SeashellsRacer - be on the lookout for a private message from me. I need to ask you some additional details. Thanks!