Skip to content

Sending data🔗

After receiving the key, you should to set up the sending data from the server or client.

What data could be sent🔗

Logs🔗

Logs are events necessary for analytics: events inside the game, purchase logs in the store, and so on.

The data is sending as JSON. One message can contain several events. The log consists of mandatory parameters (eventName and eventTime) and optional. Additional fields are just a set of parameters in key:value format. What to store in the additional fields of each event is decided by the project analyst. In total, there can be no more than 50 numeric and 50 string additional parameters.

Events example

[
    {
        "eventName": "offer",
        "eventTime": 1663225354,
        "offerName": "crystals",
        "offerValue": 12345
    },
    {
        "eventName": "offer_accepted",
        "eventTime": 1663225359,
        "offerName": "crystals",
        "offerValue": 12345,
        "hero": "barbarian"
    }
]

Important

Event names (eventName field) must contain only uppercase and lowercase Latin letters, numbers and underscores ([a-zA-Z0-9_]). Any other characters will be automatically replaced with an underscore. However, we recommend that you send event names in the specified format.

Authorization🔗

To send data using the server API, you must specify the token in the request header

Authorization: Bearer {access token}

To receive access and refresh tokens, send a POST request to https://mrgs.astrum.team/oauth/token/, specifying the following parameters in the request body: grant_type=client_credentials, scope=server, client_id={appId} (where {appId} - is your application id in MRGS) and client_secret={server secret} (where {server secret} - is your application's server key in MRGS obtained in the previous step)

curl -k -X POST https://mrgs.astrum.team/oauth/token/ \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials&client_id=38&client_secret={server_key}&scope=server"

If successful, you will receive a JSON like this in response:

{
    "access_token":"****",
    "token_type":"bearer",
    "expires_in":3600,
    "refresh_token":"****",
    "scope":"server",
    "access_token_expire":1640035236,
    "refresh_token_expire":1640118036
}

To update the access token, send a POST request to https://mrgs.astrum.team/oauth/token/, specifying the following parameters in the request body: grant_type=refresh_token and refresh_token={refresh_token} (where {refresh_token} - refresh token obtained in the previous step)

curl -k -X POST https://mrgs.astrum.team/oauth/token/ \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=refresh_token&refresh_token={refresh_token}"

Refresh token lifetime: 24 hours. Access token lifetime: 1 hour.

Sending data🔗

Sending data using the server API Use API to send logs /event/custom/.

An example of creating and sending an event

curl -X 'POST' \
'https://mrgs-api.my.games/api/38/event/custom/' \
-H 'accept: application/json' \
-H 'Authorization: Bearer ******' \
-H 'Content-Type: application/json' \
-d '[
{
    "eventTime": 1642259585,
    "eventName": "product_buy",
    "deviceId": "E2A44A7B-C339-4A35-839C-DC13FD0D2628",
    "userId": "3e9460433475b5b39d40972e496dbde3",
    "mygamesUserId": "",
    "idfa": "E25B2BC6-1A5F-4FB1-88A7-6B31D01D2BEF",
    "idfv": "878F7D70-86D1-4F1E-8B96-AEECCC49EC3F",
    "userAgent": "Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405",
    "cookies": "enwikiwmE-sessionTickLastTickTime=1622129237785; enwikiwmE-sessionTickTickCount=6; enwikiel-sessionId=04c634a1433975e42a91; enwikimwuser-sessionId=56e6e7b8e21d636590c0; GeoIP=RU:MOW:Moscow:55.75:37.62:v4",
    "country": "US",
    "language": "en"
}
]'
Sending data via SDK

Use the MRGSTracker class to create and send an event. The following is an example of creating and sending an event:

// Setting default params
MRGSTracker.SetDefaultEventParameters(new Dictionary<string, object>()
{
    {"character", "tiger"},
    {"level", 10}
});

// Send the event
MRGSTracker.TrackEvent("userInfo", new Dictionary<string, object>()
{
    {"crystalBalance", 101},
    {"goldBalance", 50},
    {"user_name", "test_user_name"},
    {"registrationDate", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()}
});

```Objective-C

// Setting default params for all events [MRGSTracker setDefaultEventParameters:@{ @"level": @(1), @"screen": @"Main view" }];

1
2
3
4
5
6
7
8
// Sending event
[MRGSTracker trackEvent:@"mrgs_testapp_event_add" parameters:@{
    @"level" : @(6),
    @"someFloat" : @(1.23f),
    @"someString" : @"test",
    @"someInt" : @(555),
}];
```
import games.my.mrgs.tracker.MRGSTracker;
import java.util.HashMap;

// Setting default params for all events
Map<String, Object> defaultParams = new HashMap<>();
defaultParams.put("level", 10);
MRGSTracker.setDefaultEventParameters(MRGSJson.toHashMap(jsonParams));

// Creating event params
Map<String, Object> userEventParams = new HashMap<>();
userEventParams.put("crystalBalance", 101);
userEventParams.put("goldBalance", 50);
userEventParams.put("user_name", "test_user_name");
userEventParams.put("registrationDate", System.currentTimeMillis());

// Send event
MRGSTracker.trackEvent("userInfo", userEventParams);

Attention

Downloading historical data could be done only through the server API. DWH correct the time from the mobile client to the current one if it differs significantly from it.

Custom profiles🔗

Custom profiles are the state of game entities. For example, a player's profile, which contains a set of his achievements, level, activity, etc. Or it can be a profile of a group, clan, any other entity. They could be analyzed together with logs: user currency balances, user ingame identifiers, and so on.

Hint

Not all user parameters should be sent in this way:

  • If you need to know the user parameter exactly at the time of the ingame event, it is better to send it as a parameter in the logs
  • Typical identifiers and user parameters (mail, attribution, geo, etc.) could be obtained in DWH not from game data, but from data from MyGames common systems (MRGS, 1Link, and so on)

Important

Custom profiles appear and refresh in DWH once a day

The data is sent as JSON. One message can contain multiple profiles. The profile consists of mandatory parametrs (entity (entity field), entity id (entityId field) and update time (updateTime field)) and optional. What should be stored in the optional parameters is decided by the project analyst.

Available optional parametrs

  • profileString1-20
  • profileInt1-10
  • profileFloat1-10

Authorization🔗

To send requests, you will need to specify an access token in the header. Detailes are described in the section of sending games logs.

Sending data using the server API

Use the API to send profiles /event/custom/profile/.

An example of creating and sending profiles:

[
  {
    "entity": "user",
    "entityId": "37793724",
    "updateTime": 1345216017,
    "profileString_1": "",
    "profileString_2": "",
    "profileString_3": "",
    "profileString_4": "",
    "profileString_5": "",
    "profileString_6": "",
    "profileString_7": "",
    "profileString_8": "",
    "profileString_9": "",
    "profileString_10": "",
    "profileString_11": "",
    "profileString_12": "",
    "profileString_13": "",
    "profileString_14": "",
    "profileString_15": "",
    "profileString_16": "",
    "profileString_17": "",
    "profileString_18": "",
    "profileString_19": "",
    "profileString_20": "",
    "profileInt_1": 0,
    "profileInt_2": 0,
    "profileInt_3": 0,
    "profileInt_4": 0,
    "profileInt_5": 0,
    "profileInt_6": 0,
    "profileInt_7": 0,
    "profileInt_8": 0,
    "profileInt_9": 0,
    "profileInt_10": 0,
    "profileFloat_1": 0,
    "profileFloat_2": 0,
    "profileFloat_3": 0,
    "profileFloat_4": 0,
    "profileFloat_5": 0,
    "profileFloat_6": 0,
    "profileFloat_7": 0,
    "profileFloat_8": 0,
    "profileFloat_9": 0,
    "profileFloat_10": 0
  }
]
Sending data via SDK
var profile = new MRGSTrackerProfile("user", MRGSUsers.Instance.GetCurrentUserId() ?? "unknown")
{
// You can use additional fields for the event if needed
ProfileString1 = "some str 1",
ProfileString3 = "3_string_mrgs",
ProfileInt2 = 1234,
ProfileFloat2 = 123.456f,
};
// Send event
MRGSTracker.TrackProfile(profile);
// Profile sending variant 1
MRGSTrackerProfile* profile = [[MRGSTrackerProfile alloc] init];
profile.profileInt2 = 222;
profile.profileFloat1 = 222.333f;
profile.profileString2 = @"test_str";
profile.profileString3 = @"mrgs sdk test profile";

[MRGSTracker trackProfile:profile];

// Profile sending variant 2
[MRGSTracker trackProfile:[MRGSTrackerProfile profileWithParametersSettingBlock:^(MRGSTrackerProfile * _Nonnull pr) {
    pr.profileInt1 = 123;
    pr.profileFloat3 = 123.45f;
    pr.profileString1 = @"mrgs";
    pr.profileString4 = @"test_profile";
    pr.profileString5 = [MRGSJson stringWithObject:@{@"testKey": @"for_json"}];
}]];
import games.my.mrgs.tracker.MRGSTracker;
import games.my.mrgs.tracker.MRGSTrackerProfile;

final MRGSTrackerProfile profile = new MRGSTrackerProfile("user", userId);
// You can use additional fields for the event if needed
profile.setProfileString1("Jon"); // set user's name.
profile.setProfileString3("2021.11.11"); // set user's login time.
profile.setProfileInt1(29); // set user's age and etc
profile.setProfileFloat1(123.4f);

// Send event
MRGSTracker.trackProfile(profile);

In case the event contains many additional fields, you can create your own event classes through inheritance to make the additional fields readable and conveniently mapped:

// Create your own event with mapping
public class CustomUserProfile : MRGSTrackerProfile
{
    public string UserName
    {
        get { return ProfileString1;}
        set { ProfileString1 = value; }
    }
    public int? GoldBalance
    {
        get { return ProfileInt1;}
        set { ProfileInt1 = value; }
    }
    public int? CrystalBalance
    {
        get { return ProfileInt2;}
        set { ProfileInt2 = value; }
    }
    public string CurrentServer
    {
        get { return ProfileString2;}
        set { ProfileString2 = value; }
    }
    public string GameLocale
    {
        get { return ProfileString3;}
        set { ProfileString3 = value; }
    }

    private DateTime _registrationDate;
    public DateTime RegistrationDate
    {
        get { return _registrationDate;}
        set
        {
            _registrationDate = value;
            var unixTime = ((value - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds / 1000L);
            ProfileFloat1 = Convert.ToSingle(unixTime);
        }
    }
}

// Send the event
MRGSTracker.TrackProfile(new CustomUserProfile()
{
    CrystalBalance = 101,
    GoldBalance = 50,
    CurrentServer = "test_server_1",
    GameLocale = "en",
    UserName = "mrgs_mrgs_mrgs",
    RegistrationDate = DateTime.Now
});
////////////////////////////////
// In GameProfile.h
////////////////////////////////
@interface GameProfile : MRGSTrackerProfile

@property (nonatomic) NSString* userName;
@property (nonatomic) int goldBalance;
@property (nonatomic) int crystalBalance;
@property (nonatomic) NSString* currentServer;
@property (nonatomic) NSString* gameLocale;
@property (nonatomic) float registrationDate;

-(instancetype)init;
+ (instancetype)eventWithConfigurationBlock:(void (^)(GameProfile* ev))block;

@end

////////////////////////////////
// In GameProfile.m
////////////////////////////////
@implementation GameProfile

+ (instancetype)eventWithConfigurationBlock:(void (^)(GameProfile* ev))block{
    GameProfile* event = [[self alloc] init];
    if(block) block(event);
    return event;
}

- (void)setUserName:(NSString *)userName {
    _userName = userName;
    self.profileString1 = userName;
}

- (void)setGoldBalance:(int)goldBalance {
    _goldBalance = goldBalance;
    self.profileInt1 = goldBalance;
}

- (void)setCrystalBalance:(int)crystalBalance {
    _crystalBalance = crystalBalance;
    self.profileInt2 = crystalBalance;
}

- (void)setCurrentServer:(NSString *)currentServer {
    _currentServer = currentServer;
    self.profileString2 = currentServer;
}

- (void)setGameLocale:(NSString *)gameLocale {
    _gameLocale = gameLocale;
    self.profileString3 = gameLocale;
}

- (void)setRegistrationDate:(float)registrationDate {
    _registrationDate = registrationDate;
    self.profileFloat1 = registrationDate;
}

@end

////////////////////////////////

// Custom mapped sending variant 1
GameProfile* mapped = [[GameProfile alloc] init];
mapped.crystalBalance = 101;
mapped.goldBalance = 50;
mapped.currentServer = @"test_server_1";
mapped.gameLocale = @"en";
mapped.userName = @"mrgs_mrgs_mrgs";
mapped.registrationDate = [NSDate date].timeIntervalSince1970;
[MRGSTracker trackUserProfile:mapped];

// Custom mapped sending variant 2
[MRGSTracker trackProfile:[GameProfile eventWithConfigurationBlock:^(GameProfile * _Nonnull ev) {
    ev.crystalBalance = 456;
    ev.goldBalance = 123;
    ev.currentServer = @"test_server_2";
    ev.gameLocale = @"ru";
    ev.userName = @"mrgs_mrgs";
    ev.registrationDate = [NSDate date].timeIntervalSince1970;
}]];
import games.my.mrgs.tracker.MRGSTracker;
import games.my.mrgs.tracker.MRGSTrackerUserProfile;

// Create your own event
class CustomUserProfile extends MRGSTrackerProfile {

    public void setUserName(String userName) {
        setProfileString1(userName);
    }

    public void setUserAge(int age) {
        setProfileInt1(age);
    }

    public void setLoginTime(String time) {
        setProfileString2(time);
    }
}

// Send the event
final CustomUserProfile profile = new CustomUserProfile();
profile.setUserName("Jon");
profile.setUserAge(29);
profile.setLoginTime("11.11.2021");

MRGSTracker.trackProfile(profile);;

Submitting advertising revenue data🔗

You can submit ad revenue data using a specialized method

Sending data using the server API

To submit your ad revenue data, use API /event/adRevenue/.

Example:

[
    {
        "eventTime": 1642259585,
        "monetizationNetwork": "ironsource",
        "mediationNetwork": "google",
        "eventRevenueCurrency": "USD",
        "eventRevenue": 0.99,
        "adUnit": "43a59750f495dec3",
        "adUnitName": "Default",
        "adType": "rewarded_video",
        "auctionId": "rewarded_video",
        "customParams": "{\"country\":\"US\",\"placement\":\"place\",\"ecpm_payload\":\"encrypt\",\"foo\":\"test1\",\"bar\":\"test2\"}",
        "deviceId": "3ADF86D6-2F97-437F-B7EC-A423BA289BAF",
        "userId": "37793724",
        "mygamesUserId": "",
        "sessionId": "",
        "idfa": "E25B2BC6-1A5F-4FB1-88A7-6B31D01D2BEF",
        "idfv": "878F7D70-86D1-4F1E-8B96-AEECCC49EC3F",
        "ip": "192.168.1.1",
        "userAgent": "Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405",
        "cookies": "enwikiwmE-sessionTickLastTickTime=1622129237785; enwikiwmE-sessionTickTickCount=6; enwikiel-sessionId=04c634a1433975e42a91; enwikimwuser-sessionId=56e6e7b8e21d636590c0; GeoIP=RU:MOW:Moscow:55.75:37.62:v4",
        "systemVersion": "13.3.1",
        "country": "RU",
        "language": "en",
        "level": 5,
        "appVersion": "1.3.4",
        "appBuild": "123456",
        "mrgsSDKVersion": "1.3.4"
    }
]
Sending data via SDK

To create and send an event, use the class MRGSTracker. Below is an example of creating and sending an event:

MRGSTracker.TrackAdRevenue("ironsource", 
    MRGSTrackerMediationNetwork.IronSource, 
    0.00123f, 
    "USD");

//Sending ad revenue impression with payload
MRGSTracker.TrackAdRevenue("vungle", 
    MRGSTrackerMediationNetwork.IronSource, 
    0.00123f, 
    "USD", 
    new Dictionary<string, string>
    {
        { MRGSTrackerEventParams.Country, "US" } ,
        { MRGSTrackerEventParams.AdUnit, "12345" } ,
        { MRGSTrackerEventParams.AdUnitName, "Default" } ,
        { MRGSTrackerEventParams.AdType, "video" } ,
        { MRGSTrackerEventParams.Placement, "place" } ,
        { MRGSTrackerEventParams.ECPMPayload, "code" } ,
        { MRGSTrackerEventParams.AuctionId, "abc-def" } ,
        { "test_param_1", "test_value_1" }
    });
//Sending ad revenue impression with payload
[MRGSTracker trackAdRevenueWithMonetizationNetwork:@"vungle"
                              mediationNetwork:MRGSTrackerMediationNetworkIronSource
                                       revenue:@(0.00123)
                                      currency:@"USD"
                                    parameters:@{
    MRGSTrackerEventParamCountry: @"US",
    MRGSTrackerEventParamAdUnit: @"12345",
    MRGSTrackerEventParamAdUnitName: @"Default",
    MRGSTrackerEventParamAdType: @"video",
    MRGSTrackerEventParamPlacement: @"place",
    MRGSTrackerEventParamECPMPayload: @"code",
    MRGSTrackerEventParamAuctionId: @"abc-def",
    @"test_param_1": @"test_value_1",
}];
import games.my.mrgs.tracker.MRGSTracker;

MRGSTracker.trackAdRevenue("ironsource",
                            MRGSMediationNetwork.GOOGLE_AD_MOB,
                            0.99,
                            Currency.getInstance(Locale.US).currencyCode);

//Sending ad revenue impression with payload
Map<String, String> payload = new HashMap<>();
payload.put("country", "US");
payload.put("ad_unit", "89b8c0159a50ebd1");
payload.put("ad_type", "banner");
payload.put("placement", "place");
payload.put("ecpm_payload", "encrypt");
payload.put("foo", "test1");
payload.put("bar", "test2");

MRGSTracker.trackAdRevenue("ironsource",
                            MRGSMediationNetwork.GOOGLE_AD_MOB,
                            0.99,
                            Currency.getInstance(Locale.US).currencyCode,
                            payload);

Dictionaries🔗

Dictionaries are tables for decoding and supplementing logs: categories of goods in the game store, characteristics of missions, quests, maps, and so on.

Important

Using this API, you could download any table for analysis. For example, a list of users who participated in the promotion event. This API is not intended for logs.

Downloading the Dictionary consists of two parts:

  • Uploading files to the MRGS file server
  • Sending metadata.

Authorization🔗

To send requests, you will need to specify an access token in the header. Detailes are described in the section of sending games logs.

File upload🔗

System support files in CSV format with the following options:

  • Header line required
  • Field delimiter — «;»
  • Escaping characters — «\»
  • For use ";" inside the field value, wrap the field in «"»
Example of a valid CSV file
dtm;id;currency;amount;active;comment
020-01-01 22:00:01;1;EUR;69.3777;true;Initial rate
020-01-01;2;USD;61.9057;false;"Wrapped string with ; character"
020-01-02 05:06:07;3;EUR;69.3777;true;"Escaped \"quotes\""
020-01-02 03:00:00;4;USD;61.9057;-1;
020-01-03;5;EUR;69.3777;false;Wow!
020-01-03;6;USD;61.9057;;
020-01-04;7;EUR;69.3777;true;
020-01-04;8;USD;61.9057;false;
020-01-05;9;EUR;69.3777;false;
020-01-05;10;USD;61.9057;false;
020-01-06;11;EUR;69.3777;false;
020-01-06;12;USD;61.9057;true;
020-01-07;13;EUR;69.3777;false;
020-01-07;14;USD;61.9057;false;
Downloading dictionary files

API is used to upload files to the file server: event/dictionary/uploadFile.

An example of a POST request to send a file:

curl -X 'POST' \
  'https://mrgs-api.my.games/api/38/event/dictionary/uploadFile/' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer bb48fd78e92bbcfd442c4e1fb9f10fb7cd214e4455eb3cc408ddc07859336ffa' \
  -H 'Content-Type: multipart/form-data' \
  -F 'dictionary=@currencies.csv;type=text/csv'

Example of a successful response:

{
  "status": 200,
  "fromCache": false,
  "serverTimeUnix": 1640009580,
  "serverTime": "2021-12-20 17:13:00",
  "action": "event_dictionary_uploadFile",
  "response": {
    "url": "https://mrgs.astrum.team/uploads/dictionary/38_1640009580.1926.csv"
  }
}

The response.url field will return the address of the uploaded file, it will be used to form the message for metadata sending.

Sending metadata🔗

The metadata of the dictionary could be sent using the API: /event/dictionary/add.

Metadata sending rules:

  • The directory can be formed from several source files.
  • The following data types are supported:
    • int — signed integer in the range of -264 to 264.
    • float — floating point number with two decimal places.
    • timestamp — date and time in the format YYYY-MM-DD HH:mm:ss or YYYY-MM-DD.
    • bool — boolean type with valid values true and false (case insensitive, others treated as NULL).
    • string — text field.
  • The order and names of the fields in the files must match the information in the metadata.
Dictionary metadata example
{
    // Meaningful part of the table name
    "tableSuffix": "currencies",

    // Links for files download
    "files": [
        "https://mrgs.astrum.team/uploads/dictionary/currencies_part0.csv"
        "https://mrgs.astrum.team/uploads/dictionary/currencies_part1.csv"],

    // Mapping of file columns and data types in the created table
    "columns": [
        {
            "name": "dtm",
            "type": "timestamp"
        }, {
            "name": "id",
            "type": "int"
        }, {
            "name": "currency",
            "type": "string"
        }, {
            "name": "amount",
            "type": "float"
        }, {
            "name": "active",
            "type": "bool"
        }, {
            "name": "comment",
            "type": "string"
        }],
}

Attention

Dictionary could be sent only via the server API

Other specialized logs🔗

To solve some typical issues in MyGames, devided types of loading data from Unified logs have been realized.

Recommendation system logs🔗

Recommendation system is a service for showing user the most relevant product in game or site store. As part of the integration into this system, project should set up uploading of necessary data. Details are described in separate documentation section.

Chat logs for Yarovaya law🔗

According to the Yarovaya law, which came into force in 2018, Internet companies and telecom operators are required to store all telephone conversations, text messages, images, audio, video recordings and other information from six months to a year, depending on the information type.

Attention

You can send chat logs only for users from the Russian Federation

The data is sent as JSON. One message can contain several events. Chat logs consist of required parametrs (message and time) and optional. What should be stored in the optional parameters is decided by the project analyst.

Available optional parametrs

  • customString1-20
  • customInt1-10
  • customFloat1-10
  • level
Sending data via server API

To send a message, use the API /event/chat/add/.

An example of creating and sending an event:

[
  {
    "message": "Hello, my friend!",
    "recipients": [
      {
        "deviceId": "3ADF86D6-2F97-437F-B7EC-A423BA289BAF",
        "userId": "37793724",
        "mygamesUserId": "",
        "idfa": "E25B2BC6-1A5F-4FB1-88A7-6B31D01D2BEF",
        "idfv": "878F7D70-86D1-4F1E-8B96-AEECCC49EC3F"
      }
    ],
    "eventTime": 1345216017,
    "deviceId": "3ADF86D6-2F97-437F-B7EC-A423BA289BAF",
    "userId": "37793724",
    "mygamesUserId": "",
    "sessionId": "",
    "idfa": "E25B2BC6-1A5F-4FB1-88A7-6B31D01D2BEF",
    "idfv": "878F7D70-86D1-4F1E-8B96-AEECCC49EC3F",
    "ip": "192.168.1.1",
    "userAgent": "Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405",
    "cookies": "enwikiwmE-sessionTickLastTickTime=1622129237785; enwikiwmE-sessionTickTickCount=6; enwikiel-sessionId=04c634a1433975e42a91; enwikimwuser-sessionId=56e6e7b8e21d636590c0; GeoIP=RU:MOW:Moscow:55.75:37.62:v4",
    "systemVersion": "13.3.1",
    "country": "RU",
    "language": "en",
    "level": 5,
    "appVersion": "1.3.4",
    "appBuild": "123456",
    "mrgsSDKVersion": "1.3.4",
    "customString_1": "",
    "customString_2": "",
    "customString_3": "",
    "customString_4": "",
    "customString_5": "",
    "customString_6": "",
    "customString_7": "",
    "customString_8": "",
    "customString_9": "",
    "customString_10": "",
    "customString_11": "",
    "customString_12": "",
    "customString_13": "",
    "customString_14": "",
    "customString_15": "",
    "customString_16": "",
    "customString_17": "",
    "customString_18": "",
    "customString_19": "",
    "customString_20": "",
    "customInt_1": 0,
    "customInt_2": 0,
    "customInt_3": 0,
    "customInt_4": 0,
    "customInt_5": 0,
    "customInt_6": 0,
    "customInt_7": 0,
    "customInt_8": 0,
    "customInt_9": 0,
    "customInt_10": 0,
    "customFloat_1": 0,
    "customFloat_2": 0,
    "customFloat_3": 0,
    "customFloat_4": 0,
    "customFloat_5": 0,
    "customFloat_6": 0,
    "customFloat_7": 0,
    "customFloat_8": 0,
    "customFloat_9": 0,
    "customFloat_10": 0
  }
]
Sending data via SDK
MRGSTracker.TrackEvent(MRGSTrackerEvents.ChatMessage, new Dictionary<string, object>()
{
    {MRGSTrackerEventParams.Message, "test_message"},
    {MRGSTrackerEventParams.Recipients, new List<object>()
    {
        new Dictionary<string, object>()
        {
            {MRGSTrackerEventParams.UserId, "test_user_1"},
            {MRGSTrackerEventParams.DeviceId, "test_device_id_1"},
            {MRGSTrackerEventParams.Idfa, "test_idfa_1"},
            {MRGSTrackerEventParams.Idfv, "test_idfv_1"},
            {MRGSTrackerEventParams.MyGamesUserId, "12345"},
        },
        new Dictionary<string, object>()
        {
            {MRGSTrackerEventParams.UserId, "test_user_2"},
            {MRGSTrackerEventParams.DeviceId, "test_device_id_2"},
            {MRGSTrackerEventParams.Idfv, "test_idfv_2"},
        },
    }},
});
NSString* message = @"User's message";

[MRGSTracker trackEvent:MRGSTrackerEventChatMessage parameters:@{
    MRGSTrackerEventParamMessage : message,
    MRGSTrackerEventParamRecipients: @[
        @{
            MRGSTrackerEventParamUserId: @"test_user_1",
            MRGSTrackerEventParamDeviceId: @"test_device_id_1",
            MRGSTrackerEventParamIdfa: @"test_idfa_1",
            MRGSTrackerEventParamIdfv: @"test_idfv_1",
            MRGSTrackerEventParamMyGamesUserId: @"12345",
        },
        @{
            MRGSTrackerEventParamUserId: @"test_user_2",
            MRGSTrackerEventParamDeviceId: @"test_device_id_2",
            MRGSTrackerEventParamIdfv: @"test_idfv_2",
        }
    ]
}];
import java.util.HashMap;
import java.util.ArrayList;

import games.my.mrgs.tracker.MRGSTracker;
import games.my.mrgs.tracker.MRGSTrackerEventParams;
import games.my.mrgs.tracker.MRGSTrackerEvents;

final String message = "User's message";

Map<String, Object> recipient1 = new HashMap<>();
recipient1.put(MRGSTrackerEventParams.USER_ID, "test_user_1");
recipient1.put(MRGSTrackerEventParams.DEVICE_ID, "test_device_id_1");
recipient1.put(MRGSTrackerEventParams.IDFA,"test_idfa_1");
recipient1.put(MRGSTrackerEventParams.IDFV, "test_idfv_1");
recipient1.put(MRGSTrackerEventParams.MY_GAMES_USER_ID, "test_my_games_user_id_1");

Map<String, Object> recipient2 = new HashMap<>();
recipient2.put(MRGSTrackerEventParams.USER_ID, "test_user_2");
recipient2.put(MRGSTrackerEventParams.DEVICE_ID, "test_device_id_2");

List<Map<String, Object>> recipientsList = new ArrayList<>();
recipientsList.add(recipient1);
recipientsList.add(recipient2);

Map<String, Object> chatParams = new HashMap<>();
chatParams.put(MRGSTrackerEventParams.LEVEL, 6);
chatParams.put(MRGSTrackerEventParams.MESSAGE, message);
chatParams.put(MRGSTrackerEventParams.RECIPIENTS, recipientsList);
chatParams.put("test_additional_param", "test_param");
MRGSTracker.trackEvent(MRGSTrackerEvents.CHAT_MESSAGE, chatParams);

What is important to consider when sending data🔗

  1. Message size limit. Request size should not exceed 128 KB. The only exception is for dictionaries files.
  2. JSON format compliance. It is required to strictly observe the data format in the SDK and API. Data that fails validation will not be uploaded to DWH
  3. Sending test data into a separate project. We recommend using different applications in MRGS for testing data upload and sending real data. It is necessary for avoiding incorrect test data in the real project.
  4. Event time validation. If the time of the event from the client differs from the current for more than a day, it will be replaced to the current server time

Last update: 2025-01-21
Created: 2021-12-16