REST API
Each analytic events contain all the properties as defined in the Analytic Event Properties. However, to save on the amount of data transmitted, the data for a batch of events is condensed when sending it to the push server. The request is made up of a JSON object with three main members:
token
This is the game skuid set when initializing the DarkMatter SDK. This identifies the game and the location of where the analytic event will go.
user
A JSON object of all the common properties between events. The event properties contained in this object are:
- a
- api
- c
- d
- did
- lg
- mid
- os
- pid
- rid
- sid
- tz
- uid
- ut
- ver
events
An array of event objects. The remaining properties specific to each event go into an object, and every event in the batch is gathered into this array.
NOTE omitted properties are treated the same as if their value was set to null.
Examples
Sending a single event
{
"token": "3a22wc2os6tnyeptorrpjmo4lh47ep5r",
"user": {
"mid": "878309d84d8e1c5fa9e928719ebd911aeec8ee0bd69a87ae54fcede9330a1279",
"uid": "4096864",
"a": "p10p_i",
"lg": "English (Canada)",
"tz": "-0500",
"c": "CA",
"os": "iPhone OS 10.3.2",
"d": "iPad4,4",
"ver": "3.3.4",
"sid": "5DE9E4CB-433A-4EBA-B4C3-4E6291BDC05F",
"did": "184D2DF8-25BB-4589-9EAD-7D424093E5DE",
"api": "3.0.0.0",
"pid": "0",
"ut": []
},
"events": [
{
"ts": "1520526693",
"tig": "339",
"n": "sess",
"st1": "LAUNCH"
}
]
}
Sending multiple events
{
"token": "3a22wc2os6tnyeptorrpjmo4lh47ep5r",
"user": {
"mid": "878309d84d8e1c5fa9e928719ebd911aeec8ee0bd69a87ae54fcede9330a1279",
"uid": "4096864",
"a": "p10p_i",
"lg": "English (Canada)",
"tz": "-0500",
"c": "CA",
"os": "iPhone OS 10.3.2",
"d": "iPad4,4",
"ver": "3.3.4",
"sid": "5DE9E4CB-433A-4EBA-B4C3-4E6291BDC05F",
"did": "184D2DF8-25BB-4589-9EAD-7D424093E5DE",
"api": "3.0.0.0",
"pid": "0",
"ut": []
},
"events": [
{
"tig": "344",
"ts": "1520526698",
"n": "locen",
"st1": "",
"v": "menu"
},
{
"n": "locex",
"tig": "344",
"ts": "1520526698"
},
{
"ts": "1520526698",
"tig": "344",
"n": "locen",
"cp": [
""
],
"v": "menu"
},
{
"ts": "1520526698",
"tig": "345",
"n": "connect",
"cp": [
"FB",
"login",
"7"
],
"v": "25"
},
{
"tig": "361",
"ts": "1520526715",
"n": "locen",
"st1": "",
"v": "options"
},
{
"ts": "1520526715",
"tig": "361",
"n": "locex",
"v": "menu"
},
{
"ts": "1520526715",
"tig": "361",
"n": "locen",
"cp": [
"menu"
],
"v": "options"
},
{
"tig": "361",
"ts": "1520526715",
"n": "mma",
"st1": "Settings",
"v": "Main Menu Action"
},
{
"tig": "366",
"ts": "1520526720",
"n": "locen",
"st1": "",
"v": "menu"
},
{
"ts": "1520526720",
"tig": "366",
"n": "locex",
"v": "options"
},
{
"ts": "1520526720",
"tig": "366",
"n": "locen",
"cp": [
"options"
],
"v": "menu"
}
]
}
REST Client Template
Here is a template that one can use in a REST client to send analytic events.
Method:
POST
URL:
https://magic-analytics.magmic.com/v2/magic.php
Headers:
Content-Type: application/json
Body:
{
"token": "",
"user": {
"mid": "manually_entered_event",
"uid": "",
"a": "",
"lg": "English (Canada)",
"tz": "-0500",
"c": "CA",
"os": "REST API",
"d": "REST API",
"ver": "",
"sid": "AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA",
"did": "DDDDDDDD-DDDD-DDDD-DDDD-DDDDDDDDDDDD",
"api": "4.2.0.0",
"pid": "99",
"ut": []
},
"events": [
{
"ts": "1520553600",
"tig": "0",
"n": "",
"st1": "",
"v": "",
"cp": [
""
]
}
]
}