Skip to main content
Version: v4

Server Integration

You can integrate directly using the REST API to report data to TapDB without relying on the SDK.

Reporting Events and Properties

Please refer to Data Specification for the format and meaning of data transmission.

If the Response Code returned is 200, it means the data reporting was successful. Please check the event writing status in the event management.

Single Report

POST https://e.tapdb.ap-sg.tapapis.com/v2/event

Content-Type: application/json

Request example:

{
"client_id": "test_appid",
"device_id": "test_device_id",
"user_id": "test_user_id",
"type": "track",
"name": "#EventName",
"properties": {
"os": "Android",
"device_id1": "000",
"device_id2": "000",
"device_id3": "000",
"device_id4": "000",
"width": 256,
"height": 768,
"device_model": "pixel",
"os_version": "Android 10.0",
"provider": "O2",
"network": "1",
"channel": "Google Play",
"app_version": "1.0",
"sdk_version": "2.8.0",
"#custem_event_property_name": "CustomEventPropertyValue",
"event_uuid": "7656c71f-6d73-488e-b740-3ab370c6f3db"
}
}

Batch Report

POST https://e.tapdb.ap-sg.tapapis.com/v2/batch

Content-Type: application/json

Request example:

{
"data": [
{
"client_id": "test_appid",
"device_id": "test_device_id",
"user_id": "test_user_id",
"type": "track",
"name": "#EventName",
"properties": {
"os": "Android",
"device_id1": "000",
"device_id2": "000",
"device_id3": "000",
"device_id4": "000",
"width": 256,
"height": 768,
"device_model": "pixel",
"os_version": "Android 10.0",
"provider": "O2",
"network": "1",
"channel": "Google Play",
"app_version": "1.0",
"sdk_version": "2.8.0",
"#custem_event_property_name": "CustomEventPropertyValue",
"event_uuid": "7656c71f-6d73-488e-b740-3ab370c6f3db"
}
},
{
"client_id": "test_appid",
"device_id": "test_device_id",
"user_id": "test_user_id",
"type": "track",
"name": "#EventName",
"properties": {
"os": "Android",
"device_id1": "000",
"device_id2": "000",
"device_id3": "000",
"device_id4": "000",
"width": 256,
"height": 768,
"device_model": "pixel",
"os_version": "Android 10.0",
"provider": "O2",
"network": "1",
"channel": "Google Play",
"app_version": "1.0",
"sdk_version": "2.8.0",
"#custem_event_property_name": "CustomEventPropertyValue",
"event_uuid": "1c11f92e-6f18-417d-8aed-ffbe668a9feb"
}
}
]
}

Common Issues

  • If the subject of the current event is neither a device nor an account, any fixed value can be passed for device_id and user_id.
  • To ensure that events reported by the server can also be analyzed using device dimensions, it is recommended to call the SDK's GetDeviceID interface on the client side to obtain the unique ID generated by the SDK for the device and report it to the app's server.

Special Event Type Reporting

Online Users

Since the SDK cannot push accurate online data, a server-side online data push interface is provided here. The game server can independently count online users at intervals of less than 5 minutes (1-minute intervals are best) and push them to TapDB through the interface. TapDB will aggregate and display the data.

Note: Online user reports are submitted in JSON format, which differs from the format of other general event reports. Please pay attention to the distinction.

POST https://se.tapdb.ap-sg.tapapis.com/tapdb/online

Content-Type: application/json

Request content:

ParameterTypeDescription
client_idstringGame's ClientID
onlinesarrayMultiple online data entries (up to 100 entries)

The structure of the onlines array is as follows:

ParameterTypeDescription
serverstringServer. TapDB only accepts one data entry for each natural 5-minute interval for the same server
onlinenumberNumber of online users
timestampnumberTimestamp (in seconds) of the current statistical data. TapDB aligns the data to natural 5-minute intervals

Example:

{
"client_id":"ClientID",
"onlines":[{
"server":"s1",
"online":123,
"timestamp":1489739590
},{
"server":"s2",
"online":188,
"timestamp":1489739560
}]
}

Common Issues

Q: How is the statistical data aligned to 5-minute intervals?

A: The x-axis of the online user chart is displayed at 5-minute intervals, corresponding to every 0, 5, and 10 to 55 minutes of each hour. The actual data collection period is 2.5 minutes before and after these time points. For example, at 10:05, it collects data from 10:02:30 to 10:07:30 (referring to the timestamp field in the reported data content, not the actual request interface time) and sums the online users for each server.

Q: How long does it take for reported data to be displayed?

A: Once a statistical period ends, the data for that period will be displayed. For example, for the period ending at 10:05, data from 10:02:30 to 10:07:30 will be displayed after 10:07:30.

Q: Why are there gaps in the online user curve?

A: Check if the reporting frequency is lower than once every 5 minutes. To ensure a smooth curve display on the chart, you can adjust the reporting frequency to once per minute and retry in case of reporting failure until successful.

Recharge Records

Due to potential inaccuracies in SDK push notifications, it is recommended to directly use the server-side recharge push interface. Note that you need to stop the reporting of recharge information from the client SDK to prevent duplicate statistics.

POST https://e.tapdb.ap-sg.tapapis.com/v2/event

Content-Type: application/json

{
"name": "charge", // Event name, fixed as charge
"client_id": "ClientID", // Required. Note that ClientID needs to be replaced with the game's ClientID
"user_id": "userId", // Required. User ID. Must be the same as the userId passed in the SDK's setUser interface and this user has already been pushed through the SDK interface
"type": "track", // Required. Data type, please ensure the value passed is track
"properties": {
"ip": "8.8.8.8", // Optional. IP of the recharge user
"order_id": "100000", // Optional. Length greater than 0 and less than or equal to 256. Order ID.
"amount": 100, // Required. Greater than 0 and less than or equal to 100000000000. Recharge amount in cents, regardless of currency, multiply by 100
"virtual_currency_amount": 100, // Required. Amount of virtual currency received, can be 0
"currency_type": "CNY", // Optional. Currency type. Three-letter code used internationally, defaults to CNY if empty. Reference: CNY for RMB, USD for US dollars, EUR for Euros
"product": "item1", // Optional. Length greater than 0 and less than or equal to 256. Product name
"payment": "alipay" // Optional. Length greater than 0 and less than or equal to 256. Recharge channel
}
}

TapDB does not deduplicate reported recharge data. When the interface returns 200, it means that TapDB has received the log data. Please check the subsequent storage status of the data in the event overview. Repeatedly reporting the same order record will result in duplicate statistics.