Home

Custom Analytics

User Analytics#

By default, users' log data are automatically stored via login and payment functionality of the Nbase SDK. With the logEvent function, it's also possible to export the log data only without the login and payment functionality integrated.

Installation#

No separate installation required. With the basic SDK installed, use the logEvent function to export the event data.

Getting started#

userId must be entered for logs to be stored correctly.


_10
NBase.setMemberId("userId");

Send events after login#


_10
NBase.trackEvent("loginlogs", (status, error) -> {
_10
});

Send events after sign-up#


_10
var loginParam = new NBaseSDK.NBase.TrackingParameter(status: true, serverId: "server#1");
_10
NBaseSDK.NBase.trackEvent("joins", loginParam, (status, error) => {
_10
if (error != null)
_10
{
_10
Debug.Log(error.Message.ToString());
_10
return;
_10
}
_10
});

Send events after payment#


_19
var purchaseParam = new NBaseSDK.NBase.TrackingParameter(
_19
status: true,
_19
productId: "P12345", // product ID
_19
paymentId: "google", // google, apple, amazon, one ...
_19
orderId: "Ord1234",
_19
currency: "USD",
_19
price: 9.99,
_19
serverId: "Server1"
_19
);
_19
_19
NBaseSDK.NBase.trackEvent("purchases", purchaseParam, (status, error) => {
_19
Debug.Log("[Unity] trackEvent...ok " + status);
_19
if (error != null)
_19
{
_19
NBaseSDK.NBase.showToast(error.Message.ToString());
_19
return;
_19
}
_19
NBaseSDK.NBase.showToast(status.ToString());
_19
});

NameTypeDescriptionRequired
productIdstringProduct IDY
paymentIdstringgoogle, apple, amazon, oneY
orderIdstringOrder ID of the transactionY
currencystringCurrencyY
pricedoublePurhcase priceY
serverIdstringServer IDN
  1. SDK utilizes useful information, such as operating system and app version, to automatically send event data.
  2. Logs that are automatically sent can be managed manually. This specific SDK does not track events automatically, requiring the trackEvent to be called. Therefore, it is recommended to run the trackEvent after the application launched.
  3. The trackEvent function does not run in the background.
  4. Only strings and integers are allowed on the user definition fields.