Available in Classic and VPC
GAMEPOT automatically saves all logs when you log in or make a payment. However, if you only save the log without using login or payment, you can save it the same way by sending it through logEvent.
No separate installation is required, and if the default SDK is installed, events can be sent through the logEvent function.
Caution
If you are using login/payment, the record is automatically made, so the feature is not required.
If you use separate logins and payments, we recommend that you use it only to save statistical logs. If you use them at the same time, logs may be saved in duplicate.
Enter user ID
Logs will be recorded properly only if you enter a user ID.
- Android
NBase.setMemberId("userId"); - iOS
NBase.setMemberId(memberId: "userId") - Unity
NBaseSDK.NBase.setMemberId("userId");
How to send event after logging in
- Android
NBase.trackEvent("loginlogs", mapOf("metadata" to "metadata")) { status, e -> if (e != null) { Toast.makeText(this, e.message, Toast.LENGTH_LONG).show() } else { Toast.makeText(this, status.toString(), Toast.LENGTH_LONG).show() } } - iOS
let eventParam: [String: Any] = ["metadata": "metadata"] NBase.trackEvent(event: "loginlogs", params: eventParam) {result in switch result { case .success(let status): // success case .failure(let error): // failure } } - Unity
var loginParam = new NBaseSDK.NBase.TrackingParameter(status: true, serverId: "server#1"); NBaseSDK.NBase.trackEvent("loginlogs", loginParam, (status, error) => { if (error != null) { Debug.Log(error.Message.ToString()); return; } }); } }
How to send event after signing up
- Android
NBase.trackEvent("joins", mapOf("metadata" to "metadata")) { status, e -> if (e != null) { Toast.makeText(this, e.message, Toast.LENGTH_LONG).show() } else { Toast.makeText(this, status.toString(), Toast.LENGTH_LONG).show() } - iOS
let eventParam: [String: Any] = ["metadata": "metadata"] NBase.trackEvent(event: "joins", params: eventParam) {result in switch result { case .success(let status): // success case .failure(let error): // failure } } - Unity
var loginParam = new NBaseSDK.NBase.TrackingParameter(status: true, serverId: "server#1"); NBaseSDK.NBase.trackEvent("joins", loginParam, (status, error) => { if (error != null) { Debug.Log(error.Message.ToString()); return; } }); } }
How to send event after payment
- Android
val eventParams = mapOf( "status" to true, "productId" to "productId", "paymentId" to "google", "orderId" to "order_id", "currency" to "USD", "price" to 0.99, "server_id" to "world#1", ) GamePot.trackEvent("purchases", eventParams) {status, e -> if (e != null) { Toast.makeText(this, e.message, Toast.LENGTH_LONG).show() } else { Toast.makeText(this, status.toString(), Toast.LENGTH_LONG).show() } } - iOS
let eventParams: [String: Any] = [ "status": true, "productId": "productId", "paymentId": "google", "orderId": "order_id", "currency": "USD", "price": 0.99, "server_id": "world#1" ] NBase.trackEvent(event: "purchases", params: eventParams) {result in switch result { case .success(let status): // success case .failure(let error): // failure } } - Unity
var purchaseParam = new NBaseSDK.NBase.TrackingParameter( status: true, productId: "P12345", // Product ID paymentId: "google", // google, apple, amazon, one ... orderId: "Ord1234", currency: "USD", price: 9.99, serverId: "Server1" ); NBaseSDK.NBase.trackEvent("purchases", purchaseParam, (status, error) => { Debug.Log("[Unity] trackEvent...ok " + status); if (error != null) { NBaseSDK.NBase.showToast(error.Message.ToString()); return; } NBaseSDK.NBase.showToast(status.ToString()); });
| Name | Type | Description | Required |
|---|---|---|---|
| productId | string | Product ID | Y |
| paymentId | string | google, apple, amazon, one | Y |
| orderId | string | Receipt number for purchase | Y |
| currency | string | Currency unit | Y |
| price | double | Purchase price | Y |
| serverId | string | Server ID | N |
- The SDK automatically enhances events with useful information such as the operating system and app version.
- You can manage the automatically transmitted server logs directly. This SDK does not automatically track events, and you must manually call trackEvent. Therefore, it is generally recommended to track events at least when the app starts.
- The trackEvent function does not run in the background.
- For user-defined attributes, only string and numeric values are allowed.