사용자 통계
게임팟은 로그인이나 결제시에 모든 로그를 자동으로 저장합니다. 하지만 로그인이나 결제를 사용하지 않고 로그만을 저장하는 경우 logEvent 를 통해서 보내면 동일하게 저장이 가능합니다.
(주의사항)
로그인 / 결제를 사용하는 경우에는 자동으로 기록이 되어 해당 기능이 필요하지 않습니다. 별도의 로그인과 결제를 사용하는 경우 통계 로그를 저장하는 경우에만 사용하기를 권장 드리며, 동시에 사용할 경우 로그가 중복으로 저장될 수 있습니다.
설치
별도의 설치가 필요하지 않으며, 기본 SDK 가 설치된 경우 logEvent 함수를 통해서 이벤트를 보내실 수 있습니다.
사용방법
사용자 ID 입력
사용자 ID 를 입력해 주셔야만 로그가 정상적으로 기록 됩니다.
NBase.setMemberId("userId");NBase.setMemberId(memberId: "userId")NBaseSDK.NBase.setMemberId("userId");로그인 후 이벤트를 보내는 방법
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()
}
}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
}
}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;
}
});
}
}회원 가입 후 이벤트 보내는 방법 :
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()
}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
}
}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;
}
});
}
}결제 후 이벤트 보내는 방법 :
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()
}
}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
}
}var purchaseParam = new NBaseSDK.NBase.TrackingParameter(
status: true,
productId: "P12345", // 상품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
상품 아이디
Y
paymentId
string
google, apple, amazon, one
Y
orderId
string
구매에 대한 영수증 번호
Y
currency
string
화폐 단위
Y
price
double
구매 가격
Y
serverId
string
서버 ID
N
SDK는 운영 체제, 앱 버전 등과 같은 유용한 정보들로 이벤트를 자동으로 향상시킵니다.
서버 자동 전송되는 로그를 직접 관리할 수 있습니다. 이 SDK는 자동으로 이벤트를 추적하지 않으며, trackEvent를 수동으로 호출해야 합니다. 이 때문에, 일반적으로 최소한 앱 시작 시에 이벤트를 추적하는 것이 권장됩니다.
trackEvent 함수는 백그라운드에서 실행되지 않습니다.
사용자 정의 속성에는 문자열과 숫자 값만 허용됩니다.
Last updated