Search Unity

  1. Full schedule for #UniteBerlin is now available! Featuring talks on our roadmap, hands-on labs and much more! Check it out!
    Dismiss Notice
  2. Unity 2018.1 has arrived! Read about it here
    Dismiss Notice
  3. Scriptable Render Pipeline improvements, Texture Mipmap Streaming, and more! Check out what we have in store for you in the 2018.2 Beta.
    Dismiss Notice
  4. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  5. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Official New Feature: Remote Settings with Segments

Discussion in 'Unity Analytics' started by ap-unity, Aug 30, 2017.

  1. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    904
    We just rolled out a new feature for Unity Analytics Remote Settings. Starting today, you can now use Segments to serve different values for your Remote Settings.

    Segmented Remote Settings

    Unity Analytics introduced Remote Settings to make it easy and fast to update games on-the-fly. With Segmented Remote Settings, your game can now adapt dynamically to a player’s behavior and characteristics.

    RS.PNG

    Remote Setting Examples

    Ramp up difficulty for new players

    rs-difficulty.PNG

    Reduce ads for users that spend money on IAP

    rs-ads.png

    Celebrate holidays for different regions of the world

    rs-holiday.PNG

    Segment Priority

    Since users can be in multiple segments, you can also adjust the segment priority, which will determine which Remote Setting a user will receive.

    rs-priority.PNG

    Documentation

    You can find more details about creating Remote Settings in our Manual:

    https://docs.unity3d.com/Manual/UnityAnalyticsRemoteSettingsCreating.html

    https://docs.unity3d.com/Manual/UnityAnalyticsRemoteSettingsUsing.html
     
  2. abusaad

    abusaad

    Joined:
    May 14, 2013
    Posts:
    4
    Segmented Remote settings is not working for my app. I am only getting the value assigned to All Current Users and not getting the respective segment values. I am not sure how to debug this issue. Can you please help me in solving this problem.
     
  3. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    1,451
    It can take some time (8-16 hours) for a particular device to be recognized as belonging to a segment. We are working to improve this. It's the same processing time required for funnels for example. Please test again after some time?
     
  4. SweatyChair

    SweatyChair

    Joined:
    Feb 15, 2016
    Posts:
    80
    1 very simple question:
    How to duplicate the tested key-value pairs from development to release? I couldn't find any button for it, or I need to manually do it?!?
     
    Last edited: Nov 1, 2017
  5. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    1,451
    This is a feature we are actively working on, keep an eye out for it in an upcoming release.
     
  6. afftar

    afftar

    Joined:
    Apr 18, 2014
    Posts:
    33
    Remote Settings work in China? It looks like I have a problem with this
     
  7. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    1,451
    @afftar Please describe your problem. Are you receiving an error?
     
  8. afftar

    afftar

    Joined:
    Apr 18, 2014
    Posts:
    33
    my question is "Remote Settings work in China?"
     
  9. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    1,451
    Yes, Remote Settings would be expected to work in China if the user has access to the Internet and our web servers.
     
    afftar likes this.
  10. afftar

    afftar

    Joined:
    Apr 18, 2014
    Posts:
    33
    This feature does not work if there are segments with conflicts, for example:

    SomeStringValue
    iOS User = "Value1"
    iOS User & From China = "Value2"
    All users = "Value3"​


    So, now we have only Value1 for all iOS and Value3 for other platforms =\ Value2 is overridden by the value from "iOS User"
    And so it happens with all segments, you need either priorities for segments or logical operations between them.
    Otherwise, we have to make composite keys of the type: "[PLATFOM][APP_VERSION]_ValueName"
     
  11. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    1,451
    @afftar We are working on this. Currently, it can take 8-16 hours for a user to be properly placed into a segment.
     
  12. afftar

    afftar

    Joined:
    Apr 18, 2014
    Posts:
    33
    This does not work, we have been living with this problem for several months
     
  13. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    1,451
  14. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    1,451
    Last edited: Dec 1, 2017
    tagh likes this.
  15. Lisan

    Lisan

    Joined:
    Jun 17, 2009
    Posts:
    130
    Hi!
    I need to do just this - roll out some feature to random 10% of all users, and then study their behaviour, and change this percent accordingly. In the way FireBase does it http://joxi.ru/823L80Mc6lEQWA
    This is basic functionality for A/B testing, where users being assigned some random but persistent IDs on the first start, and then segment is built using these IDs. Don't Unity Analytics have solution for this kind of task? RemoteConfig is great, but without this it can't be really used for A/B testing.

    Edited: Or, can i create segments from custom events parameters? In this case i can assign player a random number from 1 to 10 at a first start, store it, send it to analytics in event UserGroupId(X) and build segment with some "AND" logic to achive needed percent. But it would be better to have such functionality from the box.
     
    Last edited: Dec 13, 2017
  16. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    1,451
    @Lisan You'll see improvements in this area in the coming months as you suggest, so stay tuned!
     
    harpj likes this.
  17. Lisan

    Lisan

    Joined:
    Jun 17, 2009
    Posts:
    130
    Hi!
    As i wrote earlier, i hope to make A/B testing working with Unity Analytics. I thought this can be achieved using segments built upon custom events, but now i am not so sure, and i need confirmation of my thoughts.
    How do i think it should work:
    1) On application first start each user given a random integer number X from 1 to 10. After this, for each A/B test device sends custom event to analytics like "ABtest1(X)"
    2) In the analytics control panel i make a segment with this logic "ABTest1 = 1 OR ABTest1 = 2", that gives me random 20% of all users.
    3) I make remote config variable for this segment, and another one for other users (i believe i don't need to make special segment with logic where test don't equal 1 or 2, but just create a rule for all users below the rule for specific users)
    4) But, for this to work, user should became the part of segment at once, right after sending the event. So when we have a new user, he sends the event on app start, and right after that he requests remote config for the segment built upon this event, he already should receive correct value. But, somewhere above you have mentioned, that it needs several hours for cloud to recognize the device as a part of segment? Is this still the case? In such case this feature completely unusable for A/B testing, and maybe also for all other segment use cases. Cause even if we consider not custom events, but internal segment variables (such as country), user still not falls into segment at once, so he will get a default value at start, and another value somewhen later, which is unacceptable behavior.
     
  18. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    1,451
    @Lisan Yes getting a user quickly (immediately) into the correct segment is very high in our priority list.
     
  19. ldhongen1990

    ldhongen1990

    Joined:
    Dec 18, 2015
    Posts:
    27
    Hello Jeff and team,

    RemoteSettings is cool but it needs more work and adjustments...

    Apparently this is a show stopper, no go. Our game NEED accurate segmented remote value at build time, since for example the android download app store download link WILL BE different from the iOS app store download link. It will be redundant to direct android user to an iOS app store link and vice versa. Now this is just an example to prove a point, I believe there are many more such examples that timing will actually be rather crucial for segmented remote values, since we are not talking about pure analytics data, it's runtime design data that will need to be accurate.

    So currently the only solution is to use the old-fashion method:
    -have multiple keys instead of one segmented calibrated key, ie, instead of downloadLink, we will have one for each platform: androidDownloadLink, iOSDownloadLink, editorDownloadLink
    -use native unity scripting define in our script #if UNITY_EDITOR, #if UNITY_ANDROID, #if UNITY_IOS to grab the right value for each target platform.
    -alas, this is a hack because a feature does not work as intended.

    One other problem with RemoteSettings that I have encountered is the inability to retrieve value at least once whenever I close and open the app again, even on release build. We NEED RemoteSettings to trigger at least once whenever the user closes and open the app (yes we checked by ensuring the app is fully terminated), not on some undefined uncontrollable basis, so we fixed this by calling RemoteSettings.ForceUpdate() whenever the app is open, once. A debug log check and found out that sometimes RemoteSettings fetched this way will be fetched twice instead of once, since sometimes it will automatically fetch successfully, and then ForceUpdate forces another fetch which we will discard. So it feels kinda hacky. Perhaps a better way is to provide a function to disable automatic fetching, or make sure automatic fetching really does fetch data at least once, mitigating the need to call ForceUpdate() manually.

    We generally feel RemoteSettings is still not fully ready for productions yet because of these problems despite the fact that it should really work out of the box. The integration experience feels buggy and we are afraid there may be more bugs that we haven't discover yet.
     
  20. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    1,451
    Can you elaborate as to your mention of "build time"? We have no way of knowing what the device is until we receive the first event at run time. Also, I'm not clear on your mention of a download link, where is this link displaying, within the game? I do understand that if you have a download link within your game that is platform dependent, I agree it would be a problem to wait for the segment membership. And yes, automatic fetching does occur at app launch, can you elaborate how this is not working for you? If there is no internet access, the default settings will be used. Subsequently on the next app launch, the settings will be retrieved. And if there is no internet access, the previous settings will be used. If this is not the case, please describe how we might reproduce this behavior as you describe. Whenever I relaunch the game, the settings are retrieved. If I change the settings on the Dashboard, the next time I launch the game, these new settings are immediately retrieved.
     
  21. ldhongen1990

    ldhongen1990

    Joined:
    Dec 18, 2015
    Posts:
    27
    Hi jeff,

    this is what i meant.

    this was supposed to be the expected behaviour, but however, in some random undefine app launch with an active internet connection, the remote settings are not downloaded. I cannot reproduce this problem because it's undefine, I don't know how and when it will occur because downloading is handled by your remote setting library. What I did was I closed and reopened my app a few times (yes I cleared it off the RAM) and sometimes it just didn't download the remote settings.

    Cheers
     
  22. ldhongen1990

    ldhongen1990

    Joined:
    Dec 18, 2015
    Posts:
    27
    Jeff, does it not download on next app launch if I did not change the remote settings variables? Is this the expected behavior? It should download whatever is on the server if I relaunch the app right? Anyhow I did remember I sync new variables on the server but it still did not download on some instance of app relaunch
     
  23. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    904
    @ldhongen1990

    Real time segment assignment is a high priority on our roadmap.

    We do note in our docs that Remote Settings is an asynchronous process that might not complete before your initial Scene has finished loading, or might not complete at all, so you should always use sensible default values.
    https://docs.unity3d.com/Manual/UnityAnalyticsRemoteSettingsNetRequests.html

    That said, I have not been able to reproduce this. Using the following script, I was always able to get the latest Remote Settings (after updating and syncing) after each app start:

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.UI;
    3.  
    4. public class WelcomeMessage : MonoBehaviour {
    5.     public Text welcomeMessage;
    6.  
    7.     //default values for properties
    8.     [SerializeField]
    9.     string defaultMessage = "Hello World";
    10.  
    11.     void Start () {
    12.         Debug.Log("App Start");
    13.         //Set properties with default values
    14.         //If no network connection, then Remote Settings will not be updated
    15.         welcomeMessage.text = defaultMessage;
    16.  
    17.         //Sets up RemoteSettings callback
    18.         RemoteSettings.Updated += new RemoteSettings.UpdatedEventHandler(HandleRemoteUpdate);
    19.     }
    20.  
    21.     //remote settings callback
    22.     //Called when fetching of settings is completed. Fetching happens automatically for a new session
    23.     private void HandleRemoteUpdate() {
    24.         Debug.Log("Remote Settings Updated");
    25.         welcomeMessage.text = RemoteSettings.GetString("WelcomeMessage", defaultMessage);
    26.     }
    27. }
     
  24. ldhongen1990

    ldhongen1990

    Joined:
    Dec 18, 2015
    Posts:
    27

    I don't know. Sometimes it didn't work on my side. So I manually call ForceUpdate(), like so:


    Code (CSharp):
    1.  
    2.     // Use this for initialization
    3.     void Start()
    4.     {   RemoteSettings.Updated += new RemoteSettings.UpdatedEventHandler(RemoteSettingsUpdated);
    5.  
    6.             #if DEVELOPMENT_BUILD || UNITY_EDITOR
    7.             Log("DEVELOPMENT_BUILD or UNITY_EDITOR detected");
    8.          
    9.             #endif
    10.  
    11.             RemoteSettings.ForceUpdate();
    12.     }
    13.  
    RemoteSettings is just Unity's nicer way of downloading a json off the server, what could have possibly gone wrong?! :D Anyway, did you guys adopt some kind of cache or something? could that have been the problem?
     
  25. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    1,451
    @ldhongen1990 So it is no longer occurring for you? Without steps to reproduce, it would be difficult for us to determine your past problem.
     
  26. ldhongen1990

    ldhongen1990

    Joined:
    Dec 18, 2015
    Posts:
    27
    The problem is there, but we bypassed it by calling ForceUpdate() in Start() There is no steps to reproduce. The only way to reproduce is to keep refiring the app until you see a failure and the remote settings does not get downloaded. "When it will occur" is undefine because I cannot pinpoint exactly when. It's like you are asking me when will a memory address be this value, I can't tell you because I don't know, I only know it gets a wrong value sometimes.

    Calling ForceUpdate manually ensure remote settings gets downloaded every single time.

    Cheers
     
  27. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    1,451
    @ldhongen1990 Unfortunately there isn't much we can do without a scenario that reliably reproduces the issue. This would be the same scenario that we would use to test a potential fix, also. I will mention to the developers though, and have them keep an eye out for any potential areas within the code that might cause an indeterminate race condition or similar.
     
  28. PotatoesChipsStudio

    PotatoesChipsStudio

    Joined:
    Jan 8, 2018
    Posts:
    6
  29. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    1,451
    @PotatoesChipsStudio Are you using the Development or Release settings in the Dashboard? The Editor will always use Development settings.
     
  30. PotatoesChipsStudio

    PotatoesChipsStudio

    Joined:
    Jan 8, 2018
    Posts:
    6
    Good morning @JeffDUnity3D for the test that we have posted in the Question the editor and the devices were in Development. But it was only an example, we have detect it in release too. This is the same test in an iOS device in release:


    In the image you can see that in the Button marked in red in the iOS device appears the current Remote Setting value "All Current Users4" instead "iOS5" that is the value that the "iOS Users" standard segment remote settings has.

    The point is that when I have created the "Test" Remote Settings in Release iOS it have work perfectly, them I have erased the application from the mobile and make some changes on the Remote Settings and it looks like it stopped to work correctly it is like when I erase the application from the iOS device, download again the Remote Settings does not detect that it's an iOS. (I have test this with a Remote settings called "Test2" and it did not behave like it should the first time)

    Thanks for your time and your fast answer.
     
    Last edited: Feb 7, 2018
    EvaMuller likes this.
  31. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    1,451
    It can take a device 8-16 hours for the device type to be recognized, this is a current limitation that we are working on. During that time, the device will show up in "All Current Users". If you continue to have issues it might be best to open a support ticket on the Support tab in your Analytics Dashboard.
     
    PotatoesChipsStudio likes this.
  32. PotatoesChipsStudio

    PotatoesChipsStudio

    Joined:
    Jan 8, 2018
    Posts:
    6
    Thanks for the Answer, it is just what was happening, I have test the same application in the same devices and everything works perfectly, as you said, it looks that when an user install the application the Platform filters does not works until some hours.

    As I understand it won't happend with updates isn't it? If it's only after the first download is not a big deal for us because we always will submit the last version to the store so when the user needs to update will pass some days.

    Thanks again for your time and your patience. You should be proud with this amazing tool that totally make the difference.
     
  33. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    1,451
    This behavior would happen on launch after the first install, or subsequent re-installs. We are hoping to address this behavior in an upcoming release.
     
  34. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    874
    I've run into this issue as well. I plan to get around it with a hack. I will save which test group a user has been added to from the app and also log that to analytics for reporting. Then in the app I will pull default remote settings and for variables I want to test I will add the test group to the end of another variable defined in remote settings, e.g:

    "defaultVariable" = 1.0
    "defaultVariable_TestGroupA" = 0.5

    Both variables will be set to the "All Current Users" segment and it'll be up to the app to check if an applicable A/B test group variable is defined in remote settings.
     
  35. rg_xel_naga

    rg_xel_naga

    Joined:
    Dec 9, 2016
    Posts:
    11
    Is it possible to use "project secret key" from one project in second project with it's own "project id" and "project secret key"?
     
  36. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    904
    This wouldn't work because we authenticate the Remote Settings request using the project ID and project secret key, so if they both don't match, then you would not be able to pull the Remote Settings.

    If you want to use the same keys for multiple projects, you can export them from one dashboard and import them into another.
    rs-menu.PNG rs-menu-open.PNG
     
  37. rg_xel_naga

    rg_xel_naga

    Joined:
    Dec 9, 2016
    Posts:
    11
    Thanks in advance!