Log in

Connecting Personalize Premium plan

To connect MyTracker Personalize to the mobile app, set up event sending through the MyTracker SDK and connect the Personalize API.

Integrate MyTracker SDK

MyTracker SDK collects stats on each app user and generates the base needed to build recommendations.

  1. Connect SDK to the app that the user will interact with. For details, refer to sections iOS, Android, Unity.
  2. Ensure you configure the payment tracking and payment verification. For details, refer to the Purchase tracking section.
  3. Choose a user identification method:
    • If your application requires registration, and each user has a unique identifier, then configure user tracking with the parameter customUserId (see sections for iOS, Android, Unity).
    • customUserId should not change since the first launch of the application

    • If your application does not require registration or users do not have a unique identifier right after the first launch, you should use instanceId (see sections for iOS, Android, Unity) and pass instanceId in the customUserId parameter.
    • instanceId identifies the physical device but not the user, so the recommendation for the same user may be different on different platforms


  4. According to the instructions for events with a custom name (for iOS, Android, Unity), set the following events to be sent:
    • Offer trigger offer_trigger
    • Purchase of offer purchase_offer
    • Opening/closing an offer card offer_card
    • User account status account_status

    All events should be sent from the device (not the server). To not accumulate events in the buffer, we recommend specifying the flush parameter when you send events (see instruction for the force sending events for iOS, Android, Unity).

    All event parameters should be passed as a string; the decimal separator for real numbers should be a point.

    Events details are given below.

The placement_id, sku, and payload parameters should be specified when creating a recommendation in MyTracker. Learn more

Offer trigger

You should send the offer_trigger event when a user falls under or drops out of the offer display condition (for example, start/end of the promotion in the app).

Event parameters should be passed as a string:

Name Description Example
action* "start" if a user falls under the offer display condition
"end" if a user drops out of condition
"start"
placement_id* Offer placement identifier "A"
sku** Name of the bundle in the store (it is not unique and can be used for several offers in the store) "com.app.10dollars"
payload** Unique offer name within the application "offer.for.unpaid"
timestamp* Event timestamp (UTC+3 in seconds) "1597316958"

* — required parameter.

** — required parameter for the item recommendation and optional for the set recommendation.

Example:

let eventCustomParams = [
    "action": "start",
    "placement_id": "A",
    "payload": "offer.for.unpaid",
    "timestamp": "1597316958"
]
MRMyTracker.trackEvent(withName: "offer_trigger", eventParams:eventCustomParams)
val eventCustomParams = HashMap<String, String>()
    eventCustomParams["action"] = "start";
    eventCustomParams["placement_id"] = "A";
    eventCustomParams["payload"] = "offer.for.unpaid";
    eventCustomParams["timestamp"] = "1597316958";
MyTracker.trackCustomEvent("offer_trigger", eventCustomParams);
var IDictionary<String, String> eventCustomParams = new Dictionary<String, String>();
    eventCustomParams["action"] = "start";
    eventCustomParams["placement_id"] = "A";
    eventCustomParams["payload"] = "offer.for.unpaid";
    eventCustomParams["timestamp"] = "1597316958";
MyTracker.TrackEvent("offer_trigger", eventCustomParams));

Purchase offer

You should send the purchase_offer event right after a user makes a purchase/attempts to purchase an offer involved in the recommendation.

If the purchase has more than one offer, you should send each offer in a separate event.

Event parameters should be passed as a string:

Name Description Example
placement_id* Offer placement identifier "A"
placement_type Type of the offer card placement (it can be a different application screens).

Default value: "any"
"main"
"store"
"pop-up"
sku* Name of the bundle in the store (it is not unique and can be used for several offers in the store) "com.app.10dollars"
payload* Unique offer name within the application "offer.for.unpaid"
result* Purchase success (debit) "true"
"false"
offer_id* Offer identifier "42"
timestamp* Purchase timestamp (UTC+3 in seconds) "1597316958"

* — required parameter.

let eventCustomParams = [
    "placement_id":"A",
    "placement_type":"store",
    "sku": "com.app.10dollars",
    "payload": "offer.for.unpaid",
    "result": "true",
    "offer_id": "42",
    "timestamp":"1597316958"
]
MRMyTracker.trackEvent(withName: "purchase_offer", eventParams:eventCustomParams)
val eventCustomParams = HashMap<String, String>()
    eventCustomParams["placement_id"] = "A";
    eventCustomParams["placement_type"] = "store";
    eventCustomParams["sku"] = "com.app.10dollars";
    eventCustomParams["payload"] = "offer.for.unpaid";
    eventCustomParams["result"] = "true";
    eventCustomParams["offer_id"] = "42";
    eventCustomParams["timestamp"] = "1597316958";
MyTracker.trackCustomEvent("purchase_offer", eventCustomParams);
var IDictionary<String, String> eventCustomParams = new Dictionary<String, String>();
    eventCustomParams["placement_id"] = "A";
    eventCustomParams["placement_type"] = "store";
    eventCustomParams["sku"] = "com.app.10dollars";
    eventCustomParams["payload"] = "offer.for.unpaid";
    eventCustomParams["result"] = "true";
    eventCustomParams["offer_id"] = "42";
    eventCustomParams["timestamp"] = "1597316958";
MyTracker.TrackEvent("purchase_offer", eventCustomParams));

Opening/Closing card

You should send the offer_card every time a user opens/closes the card/screen of the offer involved in the recommendation.

Event parameters should be passed as a string:

Name Description Example
action* Action with an offer card: "open" or "close". If a user opened and closed a card, you should send a separate event with different actions. "open"
placement_id* Offer placement identifier "A"
placement_type Type of the offer card placement (it can be a different application screens).

Default value: "any"
"main"
"store"
"pop-up"
sku** Name of the bundle in the store (it is not unique and can be used for several offers in the store) "com.app.10dollars"
payload** Unique item name within the application "offer.for.unpaid"
offer_id* Offer identifier "42"
timestamp* Timestamp for opening/closing an offer card (UTC+3 in seconds) "1597316958"

* — required parameter.

** — required parameter for the item recommendation and optional for the set recommendation.

let eventCustomParams = [
    "action": "open",
    "placement_id": "A",
    "placement_type": "store",
    "sku": "com.app.10dollars",
    "payload": "offer.for.unpaid",
    "offer_id": "42",
    "timestamp":"1597316958"
]
MRMyTracker.trackEvent(withName: "offer_card", eventParams:eventCustomParams)
val eventCustomParams = HashMap<String, String>()
    eventCustomParams["action"] = "open";
    eventCustomParams["placement_id"] = "A";
    eventCustomParams["placement_type"] = "store";
    eventCustomParams["sku"] = "com.app.10dollars";
    eventCustomParams["payload"] = "offer.for.unpaid";
    eventCustomParams["offer_id"] = "42";
    eventCustomParams["timestamp"] = "1597316958";
MyTracker.trackCustomEvent("offer_card", eventCustomParams);
var IDictionary<String, String> eventCustomParams = new Dictionary<String, String>();
    eventCustomParams["action"] = "open";
    eventCustomParams["placement_id"] = "A";
    eventCustomParams["placement_type"] = "store";
    eventCustomParams["sku"] = "com.app.10dollars";
    eventCustomParams["payload"] = "offer.for.unpaid";
    eventCustomParams["offer_id"] = "42";
    eventCustomParams["timestamp"] = "1597316958";
MyTracker.TrackEvent("offer_card", eventCustomParams));

Account status

You should send the account_status at least every time the application is launched.

The table below shows general parameters that can characterize the account status. Try to find an analog in your application for the maximum number of parameters listed. To add more parameters, contact our support team.

Event parameters should be passed as a string:

Name Description Example
in_game_currency_<name> Any balances of in-game resources, where name is a resource name "444"
in_game_currency_diamonds Any balances of in-game resources, such as diamonds "5"
in_game_currency_food Any balances of in-game resources, such as food "5"
in_game_currency_gold Any balances of in-game resources, such as gold "5"
account_level Account level "5"
clan Clan identifier "123123123",
"0" — not in a clan
achievements_count Achievements count "12"
ranking Account ranking "99"
power Account power "12312312"
friends_count Friends count "56"
matches_count Matches count "21312"
wins_count Wins count "12121"
timestamp* Event timestamp (UTC+3 in seconds) "1597316958"

* — required parameter.

let eventCustomParams = [
    "in_game_currency_diamonds": "5",
    "in_game_currency_food": "10001",
    "in_game_currency_gold": "356",
    "account_level": "5",
    "clan": "123123123",
    "achievements_count": "12",
    "ranking": "99",
    "power": "12312312",
    "friends_count": "56",
    "matches_count": "21312",
    "wins_count": "12121",
    "timestamp": "1597316958"
]
MRMyTracker.trackEvent(withName: "account_status", eventParams:eventCustomParams)
val eventCustomParams = HashMap<String, String>()
    eventCustomParams["in_game_currency_diamonds"] = "5";
    eventCustomParams["in_game_currency_food"] = "10001";
    eventCustomParams["in_game_currency_gold"] = "356";
    eventCustomParams["account_level"] = "5";
    eventCustomParams["clan"] = "123123123";
    eventCustomParams["achievements_count"] = "12";
    eventCustomParams["power"] = "12312312";
    eventCustomParams["friends_count"] = "56";
    eventCustomParams["matches_count"] = "21312";
    eventCustomParams["wins_count"] = "12121";
    eventCustomParams["timestamp"] = "1597316958";
MyTracker.trackCustomEvent("account_status", eventCustomParams);
var IDictionary<String, String> eventCustomParams = new Dictionary<String, String>();
    eventCustomParams["in_game_currency_diamonds"] = "5";
    eventCustomParams["in_game_currency_food"] = "10001";
    eventCustomParams["in_game_currency_gold"] = "356";
    eventCustomParams["account_level"] = "5";
    eventCustomParams["clan"] = "123123123";
    eventCustomParams["achievements_count"] = "12";
    eventCustomParams["power"] = "12312312";
    eventCustomParams["friends_count"] = "56";
    eventCustomParams["matches_count"] = "21312";
    eventCustomParams["wins_count"] = "12121";
    eventCustomParams["timestamp"] = "1597316958";
MyTracker.TrackEvent("account_status", eventCustomParams));

Integrate Personalize API

Through requests to the Personalize API, you can receive real-time recommendations and display personalized offers within the app.

Request sending

Check out the specifics of sending requests:

  • You should send a request from different platforms (iOS, Android, Unity) separately, each with its sdk_key. To get sdk_key, embedded SDK to your app.
  • Choose one of the options for sending requests:
    • From mobile app. In this case, you should better use an asynchronous request for recommendations immediately after loading the application.
    • From mobile app backend. We recommend you do not send requests until the user has accessed the offers so that MyTracker has time to gather as much data as possible. Repeated requests should be made at least once a day.
  • Consider the following options:
    • Caching the latest recommendations on the client-side. You will be able to give the most current recommendation to the user, even if there is a problem with the network, a delay in getting a recommendation, or an error on the server-side.
    • Asynchronous request sending.
    • Using reset parameter in API requests (optionally). If reset=True, the service gives the user the most recent recommendation (offer price may change). If reset=False, the service returns the last recommendation (the offer price will remain the same).

Request format

Use GET request in the following format:

https://mlapi.tracker.my.com/v1/recommendation/method_name
  • v1 — Personalize API version;
  • method_name — name of method: item, set.

You can send a request using Swagger UI

Request for item

Use the item method to get recommendations for an offer, including a single item.

Endpoint: https://mlapi.tracker.my.com/v1/recommendation/item

Parameters:

Name Description Type Example
sdk_key* App key, embedded in SDK, is issued after adding the application String 00001234567890123456
custom_user_id* User identifier sent via SDK. It defines individual user. String 1234
flat A flag changing the answer format. Possible values:
0 — the data field is a dictionary
1 — the data field is an array

Default value: 0
Boolean 0
reset A sign of resetting recommendations on subsequent requests. Possible values:
0 — do not reset
1 — reset

Default value: 1
Boolean 1
placement_ids Offer placement identifiers. If the parameter is not specified, the recommendation will be generated for all offer placement String array A, B, C

* — required parameter.

Examples of queries

Example query:

curl --location --request GET 'https://mlapi.tracker.my.com/api/v1/recommendation/item?sdk_key=00001234567890123456&custom_user_id=1234&placement_ids=A&placement_ids=B&placement_ids=C'

Response format:

{
  "data": {
    "A":{
      "test_id": 0,
      "group_id": 0,
      "placement_id": "string",
      "offer": {
        "offer_id": "string",
        "subitems": [
          {
            "sku": "string",
            "payload": "string",
            "price": 0,
            "value": 0,
            "discount_price": 0,
            "discount_value": 0
          }
        ]
      },
    },
    "B":{}
    "C":{}
  }
}

The response includes the following data:

  • test_id: A/B test identifier
  • group_id: group identifier to which the user belongs: group for recommendations or control group
  • placement_id: offer placement identifier
  • offer_id: offer identifier
  • price: default price of the offer (not required to use)
  • value: default value of the offer (not required to use)
  • discount_price: recommended offer price
  • discount_value: recommended offer value

Example query with flat=1:

curl --location --request GET 'https://mlapi.tracker.my.com/api/v1/recommendation/set?sdk_key=00001234567890123456&custom_user_id=1234&placement_ids=A&placement_ids=B&placement_ids=C&flat=1'

Response format with flat=1:

{
  "data": [
    {
      "test_id": 0,
      "group_id": 0,
      "placement_id": "string",
      "offer": {
        "offer_id": "string",
        "subitems": [
          {
            "sku": "string",
            "payload": "string",
            "price": 0,
            "value": 0,
            "discount_price": 0,
            "discount_value": 0
          }
        ]
      },
    },
    {}
    {}
  ]
}

The response includes the following data:

  • test_id: A/B test identifier
  • group_id: group identifier to which the user belongs: group for recommendations or control group
  • placement_id: offer placement identifier
  • offer_id: identifier of the offer, including several items
  • sku: name of the bundle in the store (it is not unique and can be used for several offers in the store)
  • payload: a unique offer name within the application
  • price: default price of the offer (not required to use)
  • value: default value of the offer (not required to use)
  • discount_price: recommended offer price
  • discount_value: recommended offer value

Request for set

Use the set method to get recommendations for an offer, including a set of items.

Endpoint: https://mlapi.tracker.my.com/v1/recommendation/set

Parameters:

Name Description Type Example
sdk_key* App key, embedded in SDK, is issued after adding the application String 00001234567890123456
custom_user_id* User identifier sent via SDK. It defines individual user. String 1234
flat A flag changing the answer format. Possible values:
0 — the data field is a dictionary
1 — the data field is an array

Default value: 0
Boolean 0
reset A sign of resetting recommendations on subsequent requests. Possible values:
0 — do not reset
1 — reset

Default value: 1
Boolean 1
placement_ids Offer placement identifiers. If the parameter is not specified, the recommendation will be generated for all offer placement String array A, B, C

* — required parameter.

Examples of queries

Example query:

curl --location --request GET 'https://mlapi.tracker.my.com/api/v1/recommendation/set?sdk_key=00001234567890123456&custom_user_id=1234&placement_ids=A&placement_ids=B&placement_ids=C'

Response format:

{
  "data": {
    "A":{
      "test_id": 0,
      "group_id": 0,
      "placement_id": "string",
      "offer": {
        "offer_id": "string",
        "subitems": [
          {
            "sku": "string",
            "payload": "string",
            "price": 0,
            "value": 0,
            "discount_price": 0,
            "discount_value": 0
          }
        ]
      },
    },
    "B":{}
    "C":{}
  }
}

Example query with flat=1:

curl --location --request GET 'https://mlapi.tracker.my.com/api/v1/recommendation/set?sdk_key=00001234567890123456&custom_user_id=1234&placement_ids=A&placement_ids=B&placement_ids=C&flat=1'

Response format with flat=1:

{
  "data": [
    {
      "test_id": 0,
      "group_id": 0,
      "placement_id": "string",
      "offer": {
        "offer_id": "string",
        "subitems": [
          {
            "sku": "string",
            "payload": "string",
            "price": 0,
            "value": 0,
            "discount_price": 0,
            "discount_value": 0
          }
        ]
      },
    },
    {}
    {}
  ]
}

Both responses include the following data:

  • test_id: A/B test identifier
  • group_id: group identifier to which the user belongs: group for recommendations or control group
  • placement_id: offer placement identifier
  • offer_id: identifier of the offer, including several items
  • sku: name of the bundle in the store (it is not unique and can be used for several offers in the store)
  • payload: a unique offer name within the application
  • price: default price of the offer (not required to use)
  • value: default value of the offer (not required to use)
  • discount_price: recommended offer price
  • discount_value: recommended offer value

Status codes

Code Description
200 The request was successfully processed
400 Request error, parameters not validated

Before running the recommendation, test the event sending and the offer display on test users. See the Testing and running recommendation section.

Was this article helpful?