Import event

Methods

To send events and their parameters, use the following methods:

  • registration and registrationBatch for registration events;
  • login and loginBatch for authorization events;
  • customEvent and customEventBatch for custom events;
  • customRevenue and customRevenueBatch for custom revenue.

registration

Use the registration method to send data on the registration.

End-point: https://tracker-s2s.my.com/v1/registration/?idApp=XXX

Required parameters: customUserId

registrationBatch

Use the registrationBatch method to send batch data on registrations. This method is similar to registration but lets you send more than one event.

End-point: https://tracker-s2s.my.com/v1/registrationBatch/?idApp=XXX

Required parameters:

Name Description Type Example
One parameter without a name. It's an array, through which you can pass parameters from the registration method.
If validation rules are broken in at least one set of parameters, the server will return the error
Array. Maximum size 20 [
{"customUserId": "1111", "lvid":"00000000000000000000000000000000"},
{"customUserId": "2222", "lvid":"00000000000000000000000000000000"}
]

login

Use the login method to send data on the authorization.

End-point: https://tracker-s2s.my.com/v1/login/?idApp=XXX

Required parameters: customUserId

loginBatch

Use the loginBatch method to send batch data on authorizations. This method is similar to login but lets you send more than one event.

End-point: https://tracker-s2s.my.com/v1/loginBatch/?idApp=XXX

Required parameters:

Name Description Type Example
One parameter without a name. It's an array, through which you can pass parameters from the login method.
If validation rules are broken in at least one set of parameters, the server will return the error
Array. Maximum size 20 [
{"customUserId": "1111", "lvid":"00000000000000000000000000000000"},
{"customUserId": "2222", "lvid":"00000000000000000000000000000000"}
]

customEvent

Use the customEvent method to send data on the custom event (for example, office visit, deliveries, etc.)

End-point: https://tracker-s2s.my.com/v1/customEvent/?idApp=XXX

Required parameters: a user identifier customUserId or one of the device identifiers (instanceId, lvid, gaid, androidId, idfa, iosVendorId).
Specific parameters:

Name Description Type Example
customEventName* Name of custom event String, minimum length 1, maximum length 255 "customEventName":"messageReceived"
customEventParams Parameters of custom event array paramsName => paramValue
Array size is not limited
paramsName - string, minimum length 1, maximum length 255
paramValue - string, minimum length 1, maximum length 255
"customEventParams":{ "name1":"value1", "name2":"value2", }

* — required parameter.

customEventBatch

Use the customEventBatch method to send batch data on custom events. This method is similar to customEvent but lets you send more than one event.

End-point: https://tracker-s2s.my.com/v1/customEventBatch/?idApp=XXX

Required parameters:

Name Description Type Example
One parameter without a name. It's an array, through which you can pass parameters from the customEvent method.
If validation rules are broken in at least one set of parameters, the server will return the error
Array. Maximum size 20 [
{"customUserId": "1111", "lvid":"00000000000000000000000000000000", "customEventName": "messageReceived"},
{"customUserId": "2222", "lvid":"00000000000000000000000000000000", "customEventName": "messageReceived"}
]

customRevenue

Use the customRevenue method to send data on a custom payment. It may be any payment that couldn't pass to myTracker as ad revenue, an in-app payment, or a subscription. Like an offline purchase or a payment via WeChat Pay. For details, please refer to the Revenue tracking section.

End-point: https://tracker-s2s.my.com/v1/customRevenue/?idApp=XXX

Required parameters: eventTimestamp, a user identifier customUserId or one of the device identifiers (instanceId, lvid, gaid, androidId, idfa, iosVendorId), as well as parameters from the table below.

Name Description Type Example
idTransaction* Transaction identifier unique in the project String, minimum length 1, maximum length 255 "idTransaction": "order1234"
currency* The numeric code assigned to a currency by ISO 4217 String, length 3 symbols "currency": "USD"
total* Amount of payment Nonintegral, minimum value 0 "total": 1.99

* — required parameter.

customRevenueBatch

Use the customRevenueBatch method to send batch data. This method is similar to customRevenue but lets you send more than one payment.

End-point: https://tracker-s2s.my.com/v1/customRevenueBatch/?idApp=XXX

Required parameters:

Name Description Type Example
One parameter without a name. It's an array, through which you can pass parameters from the customRevenue method.
If validation rules are broken in at least one set of parameters, the server will return the error
Array. Maximum size 20 [
{"customUserId": "1111", "lvid":"00000000000000000000000000000000", "idTransaction": "order1", "currency":"USD", "total": 1.99},
{"customUserId": "2222", "lvid":"00000000000000000000000000000000", "idTransaction": "order2", "currency":"USD", "total": 10.99}
]

Parameters

All parameters are passed in the request body in JSON format.

Limit on the maximum size of imported data - 10Kb.

Name Description Type Example

Common

eventTimestamp Event time Number, minimum value 0, maximum value 4294967295. By default - timestamp of receiving the event "eventTimestamp":"1577191920"
customUserId User identifier in your app String, maximum size 1024 "customUserId":"1234"
ipv4 ipv4 address String, maximum size 15 "ipv4":"125.125.125.125"
ipv6 ipv6 address String, maximum size 45 "ipv6":"2001:0db8:85a3:0000:0000:8a2e:0370:7334"
idGender Gender Number, possible values:
  • 0 - unknown
  • 1 - man
  • 2 - woman
"idGender":"1"
age Age Number, maximum value 128 "age":"38"
connectionType Connection type Number, possible values:
  • 0 - unknown
  • 1 - mobile
  • 2 - wi-fi
By default 0
"connectionType":"1"
bluetoothEnabled Bluetooth Number, possible values:
  • 0 - unknown
  • 1 - on
  • 2 - off
By default 0
"bluetoothEnabled":"2"

For mobile platform

instanceId S2S device identifier String, number of symbols 36 "instanceId":"00000000-0000-0000-0000-000000000000"
adTrackingEnabled Tracking permission Number, possible values:
  • 1 - on
  • 0 - off
By default 1
"adTrackingEnabled":"0"
iOS
idfa iOS advertising identifier String, number of symbols 36 "idfa":"00000000-0000-0000-0000-000000000000"
iosVendorId iOS vendor identifier String, number of symbols 36 "iosVendorId":"00000000-0000-0000-0000-000000000000"
Android
gaid Android advertising identifier String, number of symbols 36 "gaid":"00000000-0000-0000-0000-000000000000"
androidId Android identifier String, number of symbols 16 "androidId":"000000000000000"

For Web platform

lvid S2S device identifier String, number of symbols 32 "lvid":"00000000000000000000000000000000"
adBlocker Ad blocker Number, possible values:
  • 1 - on
  • 0 - off
By default 0
"adBlocker":"0"
userAgent User-Agent String, maximum size 2048 "userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36"

Example query

HTTP POST request:

curl https://tracker-s2s.my.com/v1/customEvent/?idApp=666 \
–k –X POST --header "Authorization: skjdfASFasf03asdffar3asJHB32r" \
-d '{"customUserId": "1", "customEventName": "levelUp",
"customEventParams": {"level": "2"}, "idGender": "1",
"age": "25", "eventTimestamp": "1580213208",
"instanceId": "00000000-0000-0000-0000-000000000000"}'

PHP SDK:

$idApp = 666;
$token = 'skjdfASFasf03asdffar3asJHB32r';
$accountCredentials = new Credentials($token);
$customEventMethod = new CustomEventMethod($accountCredentials, $idApp);
$customEventMethod->params()
   ->setCustomUserId('1')
   ->setCustomEventName('levelUp')
   ->addCustomEventParam('level', '2')
   ->setIdGender(Gender::MALE)
   ->setAge(25)
   ->setEventTimestamp(1580213208)
   ->setInstanceId('00000000-0000-0000-0000-000000000000');

$client = Client::getDefault();
$client->request($customEventMethod);

Status codes

Code Text Description
200 {"message": "ОK"} The request was successfully processed
400 {"error": "Bad Request"} Request error, parameters not validated
403 {"error": "Forbidden"} The token has not been validated or is not suitable for the application
400 {"error": "Empty post data"} Empty request body
400 {"error": "Bad json"} Passed an invalid JSON file in the request body
400 {"error": "Bad api version"} Unsupported API version
404 {"error": "Method not found"} API method not found
500 {"error": "Internal Server Error"} Internal API error. Try to repeat the request later