Recommendations

Getting recommendations with Matchable's API is really simple.

Recommendations are strings that trigger actions in your game. You can define their value in the dashboard.

  • Getting recommendations with curl

    Here’s an example of request with curl:

    
                curl -X GET --header 'Accept: application/json' 'http://api.matchable.io/v1.0/users/<user_id>/recoms'
              

    Here’s an example of callback you will get:

    
                {
                  "user_id": "<user_id>",
                  "group": 273,
                  "is_control_group": true,
                  "recoms": [
                  "give_gold_50",
                  "show_popup_ad1"
                  ]
                }
              
    Key Description
    user_id unique player’s identifier.
    group_id group ID of the user, special value: -1 if no A/B test is running or if no group has been assigned to user for running test.
    is_control_group true if user is part of a control group for the running A/B test, false if no A/B test is running or no group has been assigned to user for running test.
    recoms string-valued array of recommendations returned by strategy, empty array if no A/B test is running or strategy returns no recommendation for given user.

    Assignment of a user to a group happens when actions are sent the first time for a given user_id since an A/B test has started. The group_id for a user changes with every new A/B test.

    In that example, the user is in the A/B test control group and Matchable's recommendations are showing one advertisment popup and give some gold as a bonus.

    To see examples of requests or any other detail regarding the current API, please refer to the online documentation.

  • Getting recommendations with Unity

    To facilitate this integration, Matchable provides a SDK for the Unity framework:
    https://github.com/Matchable/matchable-unity-sdk

    Here’s an example of request with Unity:

    
                    public IEnumerator DemoGetRecommendations()
                    {
                      _test = "Matchable.GetRecommendations()";
                      _log = "Waiting for response...";
                      // Call GetAdvisor asynchronously as a Coroutine
                      yield return StartCoroutine(Matchable.GetRecommendations((response) =>
                      {
                        // Handle the API response the way you want
                        _log = response.ToJsonString();
                        // Ex: get the recoms value
                        _log += "\n\nRecoms: " + response.GetValue("recoms");
                      }));
                    }
                  

    Now all you need is to parse the "recoms" value to process ingame actions.